Gradients?

BlitzMax Forums/BlitzMax Programming/Gradients?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Oh, Using the correct GraphicsDriver could be good :P
Now I have another issue though, Using DrawText in the same loop as this function has some strange effects, the Gradient just disappears..
Any thoughts on why? :S

SetGraphicsDriver(GLMax2DDriver())
Graphics 640,480,0,0

Repeat

	DrawGradient( 100, 100, 100, 100, 255, 0, 0, 255, 255, 255 )
	
	If KeyDown( KEY_SPACE )
		DrawText( "THIS IS TEXT!", 0, 0 )
	EndIf
	
	Flip( 1 );Cls

Until KeyHit(KEY_ESCAPE)
End

Function DrawGradient(x:Float,y:Float,w:Float,h:Float,r0:Float=255.0,g0:Float=0.0,b0:Float=0.0,r1:Float=255.0,g1:Float=255.0,b1:Float=0.0,direction:Int=0)

	r0 = r0/255.0
	g0 = g0/255.0
	b0 = b0/255.0
	
	r1 = r1/255.0
	g1 = g1/255.0
	b1 = b1/255.0

	glBegin GL_QUADS
		glColor3f r0,g0,b0
		glVertex2f x,y

		If direction = 0
			glColor3f r0,g0,b0
		Else
			glColor3f r1,g1,b1
		EndIf
		glVertex2f x+w,y

		glColor3f r1,g1,b1
		glVertex2f x+w,y+h

		If direction = 0
			glColor3f r1,g1,b1
		Else
			glColor3f r0,g0,b0
		EndIf
		glVertex2f x,y+h
	glEnd
	
EndFunction