Draw image without texture?

BlitzMax Forums/BlitzMax Programming/Draw image without texture?

hehe, I don't know OpenGL, but playing with some code I got the OpenGL version. and work with setcolor. :)

Maybe somebody can check the code.


Graphics 800,600,0

Global image:TImage=LoadImage("bmax160_2.png")
Local n:Float

SetBlend AlphaBlend
SetColor 255,255,255
	
While Not KeyHit(key_escape)
  Cls
	SetAlpha 1
	DrawImage image,100,100
	SetAlpha n
	SetShapeColor(128,255,255)
	DrawImage image,100,100
	SetNormal()
	Flip
    n=(n+0.01) Mod 1
Wend


Global red:Int,green:Int,blue:Int
Function SetShapeColor(r:Int,g:Int,b:Int)
	GetColor red,green,blue
	SetColor r,g,b
	GlTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE)
	GlTexEnvf(GL_TEXTURE_ENV,GL_COMBINE_RGB,GL_REPLACE)
	GlTexEnvf(GL_TEXTURE_ENV,GL_SOURCE0_RGB,GL_PREVIOUS)
	GLTexEnvf(GL_TEXTURE_ENV,GL_OPERAND0_RGB,GL_SRC_COLOR)
EndFunction

Function SetNormal()
	SetColor red,green,blue
	GLTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, 0);
EndFunction