Advertisement

[NEWBIE] 2 Quick Questions

Started by January 18, 2001 12:34 AM
8 comments, last by deadbeat 23 years, 10 months ago
Hey all... My first question is about printing text to the screen using the method in tutorial 13. I''ve added all the relevant code to one of my experimental projects. However, my text always shows up black. It shows up fine, its just not colored right. Instead of using the fancy coloring like in the tutorial I''m just trying basic colors like: glColor3f(1.0f,0.0f,0.0f); For some reason it will only appear black. Anybody have any ideas? My code looks like this: glLoadIdentity(); glTranslatef(0.0f,0.0f,-1.0f); glRasterPos2f(-0.54,-0.39); glColor3f(1.0f,0.0f,0.0f); glPrint("Score: "); That''s in DrawGLScene, the rest of the code is exactly the same except for the part that makes the text move. Any help would be appreciated. And my second question is: What''s the easiest way to calculate the framerate? Thanks..... -db jeff@hype52.com
-dbjeff@hype52.comwww.pricezapper.com
Try glDisable(GL_TEXTURE_2D) for your text.
Advertisement
To calc fps use the GetTick() in win32.
Measure Fps in DrawGL proc.

easiest way?
______________________________Only dead fish go with the main-stream.
another reason that you may have problems with the color is that if you have lighting enabled and color tracking disabled, the text may appear black (or colourless to be more precise). the easiest way to combat this is to:

disable lighting
draw text
re-enable lighting

or conversely, set up color material properties so the objects colour is affected by the lighting properties. but i would imagine since this is text that you are displaying, colour tracking is hardly useful or desirable, so disabling lighting would be the way to go...
getTick might not be accurate enuf. have a look at NeHe''s tut on Timing. Also I can mail you an easy FPS class i''ve written based on his code.
Thanks everyone for your posts...I''m going to try it here in a little while, I''ll post my results.

And RealityMonster I''d be interested in seeing what you''ve come up with, email it to me at jeff@hype52.com if you can. I''d email you but I''m having some probs with my smtp server.

Thanks again everyone :}}}}


-db
jeff@hype52.com
-dbjeff@hype52.comwww.pricezapper.com
Advertisement
Hi,

Have you tryed glEnable(GL_COLOR)
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
Hi,

Have you tryed glEnable(GL_COLOR)
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
Mm. I''ve only recently begun fooling around with OpenGL, but one of the things I seem to remember is that once you set a glRasterPos, all bitmap blitting..stuff is done with the current color at the time of the glRasterPos. So, you might try swapping the glRasterPos and glColor calls.
Ok.... sure enough it was the glEnable(GL_TEXTURE_2D); so all i did was disable it before printing my text and then re-enable it afterwords (to draw the rest of my scene). Much thanks to everyone that replied, i was stumped there for a while :}

-db
jeff@hype52.com
-dbjeff@hype52.comwww.pricezapper.com

This topic is closed to new replies.

Advertisement