Slow OpenGL backdrop...

Started by
0 comments, last by Lethe 23 years, 4 months ago
I''m using a windowed OpenGL app and using

glRasterPos2f(-1,-1);
glDrawPixels(640,480,GL_RGB,GL_UNSIGNED_BYTE,View.DataP());
 
to draw a bitmap to screen, it works fine except that I''ve timmed these 2 lines at 0.1 seconds for each frame. Concidering I''m using it for video decompression at 15fps, this is not good:-(To put this in prespective, my video compression takes 0.08 seconds to do the actuall decompression(With dct''s and color conversion.), and I havn''t begun to optimise it yet....) How do I get this faster? Concidering there is no format conversion, it should be lightning quick, so why? -Lethe
Advertisement
glDrawPixels() is just a very slow command, and you''ll have to learn to live with that. Directly writing to the framebuffer is not recommended, so you''ll have to deal with it in a slightly different way.

What you can do is decompress your video data (640x480) to a 1024x512 buffer. This wastes some memory, but you can use that buffer as a texture, and you can then display the video by rendering a single texturemapped quad that fills your window. For best performance, use glCopyTexSubImage2D() to update only the 640x480 portion of the texture for every frame.

- Tom
Tom Nuydens delphi3d@gamedeveloper.org www.gamedeveloper.org/delphi3d

This topic is closed to new replies.

Advertisement