printing coloured text LOADFONT tip

Previous topic - Next topic

fuzzy70

Just a quickie. While playing around with the font creator program I had a problem with colours while using opengl commands. The 1st print works perfectly (excuse the colours, they was planned that way as to see the shadow & outline where working), however the 2nd one came out dark (see attached pic).

After a lot of head scratching & commenting/un-commenting the code it works out the glColor3f(0.2, 0.2, 0.2) was to blame, if you set it back to glColor3f(1,1,1) before using print again it comes out as it should.

Just thought I would mention it in case someone else came across it & save them the joys of wondering whats going on  =D

the testcode (obviously you need a font to load with some colour in it)

Code (glbasic) Select
SETCURRENTDIR("Media")
LOADFONT "smalfont6.png",1
SETFONT 1

//SLEEP 5000
PRINT "Hello", 10,10

glClear(0)

starttime%=GETTIMERALL()

glColor3f(0.2, 0.2, 0.2)
FOR x%=0 TO 799
FOR y%=0 TO 599
//SETPIXEL x%,y%,RGB(100,100,100)
glBegin(GL_LINES)
glVertex2f(x,0)
glVertex2f(x,599)
glEnd()
NEXT
NEXT
//glColor3f(1, 1, 1)
totaltime%=GETTIMERALL()-starttime%
PRINT totaltime%,100,100
SHOWSCREEN
MOUSEWAIT
END


[attachment deleted by admin]
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)