View Full Version : Bitmap Performance
06-25-2002, 09:18 AM
I have a big bitmap image and I have to load it every time I redisplay the scene (I have made a display list and I call it). But the performance is very bad. How could I get rid of calling it every time? I mean, is there a way of calling it one time and then do other operations while the picture is still there?
06-25-2002, 10:46 AM
First of all, when you say bitmap, are you talking about a bitmap in windows terms (a matrix of pixels in different colors) or in the OpenGL terms a matrix of bits (0/1) ?
If you are talking about the first case, then it depends on how you display it, glDrawPixels is very slow, if you create a texture and put it on a quad you should get ok performance.
If youi are talking about the second case there isn't much you can do about it, I think most hardware today does not put a high priority on bitmaps so the performance could be suffering a bit there.
06-25-2002, 11:26 AM
It's the same as the first case. But the problem is that: the display function should be called several times in one second, so the performance is still bad.
What I want to know is there a way to prevent calling the display list (of the quad) each time I call the display func?
I know that seems a bit strange but...
06-27-2002, 09:11 PM
You load the bytes of the bitmap into an unsigned char * or (GLUByte *). Then you dont need to read the file anymore. Once you have it loaded, you do something like this, once:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
Then you only need to do this to activate it on each frame update:
yes display lists (with textures) were really only needed in opengl1.0, since opengl1.1 (which has been around for years) the above (ioquan) method is better (texture objects).
are u learning from an ancient code sample?
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.