PDA

View Full Version : TBGL_Color



ReneMiner
21-05-2013, 09:19
How about some additional TBGL_Color-Method which takes a pointer to either some color-equate or to some user-color?

the current use of tB-Color-Equates in TBGL:


Uses "CONSOLE", "TBGL"

Dim myColor As TBGL_TRGB
myColor.R = 123
myColor.G = 45
mycolor.B = 67

PrintL
PrintL "myColor"
PrintRGB(VarPtr(myColor))

PrintL "%RGB_INDIANRED"
PrintRGB(VarPtr(%RGB_INDIANRED))

PrintL "%RGB_Yellow"
PrintRGB(VarPtr(%RGB_YELLOW))

PrintL "%RGB_ForestGreen"
PrintRGB(VarPtr(%RGB_FORESTGREEN))

PrintL "%RGB_MidnightBlue"
PrintRGB(VarPtr(%RGB_MIDNIGHTBLUE))

WaitKey

Sub PrintRGB(ByVal ptrRGB As DWord )

PrintL "Red : " + Str$(Peek(ptrRGB))
PrintL "Green : " + Str$(Peek(ptrRGB+1))
PrintL "Blue : " + Str$(Peek(ptrRGB+2))
PrintL

End Sub

would be nice if I could write


TBGL_ColorPtr(Varptr(myRGBColor))
TBGL_ColorPtr(VarPtr(%RGB_IndianRed), %TBGL_DATA_RGB)
TBGL_PushColorPtr(VarPtr(myRGBAColor), %TBGL_DATA_RGBA)
' instead of sometimes 3 or 4 times calculating the desired color-index nor need an additional
' variable to store the index for this nor needs an additional script-function call

where (optional) %TBGL_DATA_...-switch tells the function what kind of data to await, I guess RGB by default...

Petr Schreiber
21-05-2013, 16:17
Hi Rene,

there is such a function in OpenGL, it is called glColor3ubv for RGB and glColor4ubv for RGBA.

You could use it like:


#include "thinBasic_gl.inc"

...

glColor3ubv(ByVal VarPtr(MyRGBVariable))
glColor4ubv(ByVal VarPtr(MyRGBAVariable))



Petr