Why is this so slow?

Started by
10 comments, last by DanG 21 years, 7 months ago
I was working on getting some image handling code working when I realized that the framerates I was getting, doing almost nothing, were terrible. All I do each frame is draw 2 256x256 bitmaps at 2 spots on the screen, here is the code: glRasterPos2f(-.5,-.5); glDrawPixels(m_Image.Width(), m_Image.Height(), m_Image.Format (), GL_UNSIGNED_BYTE, m_Image.Data()); glRasterPos2f(0, 0); glDrawPixels(m_Image2.Width(), m_Image2.Height(), m_Image2.Format(), GL_UNSIGNED_BYTE, m_Image2.Data()); I''m only getting 7-8 FPS. Awful! My profiling (done with a code profiler from Game Gems) shows that 70% of the time is spent on that code. My computer isn''t to0 great (500 mhz, ATI Rage Pro 2mb) but it can do A HECK OF A LOT MORE than draw to images in 120 ms. What could I be doing to make this so slow?
Ambassador: Mr. Bush are you stoned or just really, REALLY dumb?Pres. Bush - I assure you I am not stoned.
Advertisement
The problem is your card. That model has terrible support
for opengl. I would advice you to upgrade to a better card.
You can find gf2mx cards for very cheap prices.
I know my card is bad, but its not THIS bad. Putting 2 bitmaps on screen should take almost no time. Something I am doing is causing it to take more time than rendering 150 tris. What the heck is going on here?
Ambassador: Mr. Bush are you stoned or just really, REALLY dumb?Pres. Bush - I assure you I am not stoned.
It does seem weird, it could just be that the drivers are not very optimized (or it hurts the hardware) when changing the raster pos directly, maybe you''d be better rendering the two bitmaps as quads and seeing if that gives a speed up.
Don''t do it with glDrawPixels use texture maps instead.
quote:Original post by DanG
(500 mhz, ATI Rage Pro 2mb


What resolution and color depth are you running at? With the 2 256x256 bitmaps it may simply be too large to fit in video memory, resulting in slow tranfer (I''m assuming its a PCI card since its only 2MB). The point about OpenGL is true too, early ATI cards where not the best for OpenGL (I get similar slowdowns on an ATI Expert@Play 98 Rage Pro 8MB)

AP is right. Load images as textures and draw 2 quads and it should be much faster.
Michalson : He''s not even using textures. He''s pulling data from system RAM every frame.

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
I changed to 2 texture mapped quads, now the FPS is 10. Not much better. The image uses the Alpha channel and I have blending enabled, could that be a big slow down? I checked size, and it should fit in texture memory (512 kb). Any other ideas?
Ambassador: Mr. Bush are you stoned or just really, REALLY dumb?Pres. Bush - I assure you I am not stoned.
Trust me on this one. I have been coding gl on that very card model. It truly is slow and there is no GL support. Only software, that is the source of your troubles.
You really do need a better card.
The (other?) AP is right - glDrawPixels is very slow. You need to use textured quads (or preferably triangles). Since you've done this the only other thing I can suggest is to either use a better card or disable as many 3D pipeline features as possible.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions


[edited by - siaspete on August 30, 2002 7:00:36 PM]

This topic is closed to new replies.

Advertisement