Any better way of printing text in OpenGL...
I used NeHe's code from one of his tutorials to display bitmapped fonts on the screen so I can display the FPS & other information related to my demo.
The problem is that it causes a drop in frame rate. I get a decent 60 FPS without displaying any text but as soon as I start displaying more than one line of text (roughly 10 characters long), the frame rate drops down to 30 FPS.
Also, when switching from windowed mode to fullscreen and back, the text doesn't get rendered and the FPS jumps up again.
I tried using Windows API but apparantly that doesn't work and the program simply crashed.
If anyone knows of a better way that doesn't bog down the frame rate, I would appreciate a response to this topic.
BTW: If anyone would like to know system specifics: I have a Pentium II 400MHz with 128MB RAM, ATI 3D Rage Pro with 8MB video RAM (I know its ancient but it works fine for the most part with what I do - Quake 3 seems to run fine ).
Thanks.
------------------------
DaWizard
------------------------
Edited by - DaWizard on 12/20/00 9:16:44 AM
------------------------------------------------DaWizardhttp://www.geocities.com/ahmadkabani------------------------------------------------
you can use the glf library, i cant remember the link, but it''s on the nehe''s page... or you can also use the glut to draw strings
I figured out how to use the Win32 API DrawText(..) to print string but the string flickers (not the scene, only the string). It is faster (70 FPS when I use backface culling with my BSP Tree ) But it is annoying . It doesn''t crash either.
overlord: Thanks, I''ll look into that library. Hopefully something good comes of it.
overlord: Thanks, I''ll look into that library. Hopefully something good comes of it.
------------------------------------------------DaWizardhttp://www.geocities.com/ahmadkabani------------------------------------------------
Go to this topic and look for my reply where I tell how to disable the "vertical syncronization" for OpenGL.
(You''ve got 60 FPS and a dropdown to 30 because your vsync is ON)
You''ll need to reload your textures/displists when you go fullscreen/windowed (bitmapped fonts are in displists).
Don''t ever mix GDI commands with OGL because it''ll crash your program (but you''ve already seen that )
Hope that helps.
(You''ve got 60 FPS and a dropdown to 30 because your vsync is ON)
You''ll need to reload your textures/displists when you go fullscreen/windowed (bitmapped fonts are in displists).
Don''t ever mix GDI commands with OGL because it''ll crash your program (but you''ve already seen that )
Hope that helps.
quote: Original post by richardve
Go to this topic and look for my reply where I tell how to disable the "vertical syncronization" for OpenGL.
(You''ve got 60 FPS and a dropdown to 30 because your vsync is ON)
You''ll need to reload your textures/displists when you go fullscreen/windowed (bitmapped fonts are in displists).
Don''t ever mix GDI commands with OGL because it''ll crash your program (but you''ve already seen that )
Hope that helps.
I''m not enabling vertical synchronization (not even horizontal synchronization and composite synchronization).
However, I don''t understand why VSync would affect FPS when displaying bitmapped fonts. My program renders around 90-140 quads with lighting in the scene. Without the text, it runs at a reasonable frame rate. As soon as I display text, it drops down. So the problem is probably with the way the text is rendered. I may be wrong to say that since I have never used bitmapped fonts before.
I gave up on the GDI commands because it causes flickering probably because opengl renders the scene on top of what GDI prints.
------------------------------------------------DaWizardhttp://www.geocities.com/ahmadkabani------------------------------------------------
If I read this correctly it''s the same trouble as mine. I explained the solution in "lesson13 problem" of this forum. Try and check it out, and may it helps.
If I read this correctly it''s the same trouble as mine. I explained the solution in "lesson13 problem" of this forum. Try and check it out, and may it helps.
Disclaimer: I''ve not tried NeHe''s font, so this post might be a little ignorant.
You can also use quads with blended textures on them. It works good and fast for me! I dont want to bore you to death with another link to my homepage, but I need the hits to buy some bread for tomorrow There''s a CFont class with the OOEngine if you are interrested.
You can also use quads with blended textures on them. It works good and fast for me! I dont want to bore you to death with another link to my homepage, but I need the hits to buy some bread for tomorrow There''s a CFont class with the OOEngine if you are interrested.
forcecoder I fixed the problem with the fonts not displaying when I switch modes. I placed calls to KillFont() and BuildFont() and re-enabled lighting. Some one here mentioned that these have to be reloaded along with the textures.
baskuenen I checked your site out. Cool stuff. I couldn''t find the CFont class though (maybe because I''m tired now). I could definitely use some OOP code because all my stuff for generating the BSP Tree are Object Oriented classes. I found it much easier to code. I''ll check again tomorrow.
I''m almost finished writing my BSP Tree program. I have to finish coding the stuff for calculating texture coordinates for polygons that get split by a partition.
Thanks guys, I appreciate all the help.
------------------------
DaWizard
------------------------
baskuenen I checked your site out. Cool stuff. I couldn''t find the CFont class though (maybe because I''m tired now). I could definitely use some OOP code because all my stuff for generating the BSP Tree are Object Oriented classes. I found it much easier to code. I''ll check again tomorrow.
I''m almost finished writing my BSP Tree program. I have to finish coding the stuff for calculating texture coordinates for polygons that get split by a partition.
Thanks guys, I appreciate all the help.
------------------------
DaWizard
------------------------
------------------------------------------------DaWizardhttp://www.geocities.com/ahmadkabani------------------------------------------------
Found the CFont class. I have to figure out how it works to use it. Thanks baskuenen, I hope it is OK with you that I use your code.
------------------------
DaWizard
------------------------
Edited by - DaWizard on December 21, 2000 11:38:17 AM
------------------------
DaWizard
------------------------
Edited by - DaWizard on December 21, 2000 11:38:17 AM
------------------------------------------------DaWizardhttp://www.geocities.com/ahmadkabani------------------------------------------------
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement