Drawrect with gradient of color

BlitzMax Forums/BlitzMax Programming/Drawrect with gradient of color

Pete Rigz(Posted 2007) [#1]
Is there an easy way to drawrect and change its vertex colours so that blends its colour from one edge to the next?

I basically want to create a gradient of colour. Thanks!


ImaginaryHuman(Posted 2007) [#2]
You can if you write your own GL or DX code because you have to define the color of each vertex before defining the vertex itself ie color/vert/color/vert/color/vert/color/vert and if you want it textured it has to be color/tex/vert/color/tex/vert/color/tex/vert/color/tex/vert to define the texture coords also.


tonyg(Posted 2007) [#3]
this for gl?and this for dx?
<EDIT> That's better...
Graphics 800 , 600
color1 = $ffff0000
color2 = $ff00ff00
color3 = $ff0000ff
color4 = $ffff00ff	
D3D7Max2DDriver().vrts[3] = color1
D3D7Max2DDriver().vrts[7] = color2
D3D7Max2DDriver().vrts[11] = color3
D3D7Max2DDriver().vrts[15] = color4
DrawRect 0 , 0 , 100 , 100
Flip
WaitKey()



CS_TBL(Posted 2007) [#4]
tonyg, the search-alternative of this forum.. :P


tonyg(Posted 2007) [#5]
Just edited my post with some code BUT when you're searching for 'Gradients' it's worth giving the search function a stab.
There is so much good (and bad) stuff to find.


Pete Rigz(Posted 2007) [#6]
Cheers Tony.