memory problem with textures in display list

i’m mapping texture to achieve high quality rendering. My textures are 3000*2000 (that’s ok on a n nvidia card).

It works well for a few textures but when using many of these large textures, i get an “out of memory” error from openGL and the last textures are not rendered.

I feel it’s related to the fact i’m using display list for textures. This is known to use much memory and it does in my case, process is up to 800Mo of RAM. And the error pops up at the line glTexImage2D when i’m creating my display list.

Any idea about how to solve that ?
I agree I can reduce texture size and it works. But i’d like to understand precisely why it uses so much memory.


Ouch! Never use glTexImage inside a display list. It stores the full image. That is OpenGL 1.0 style when there were no texture objects.

Use texture objects to download your textures with glGenTextures, glBindTexture, glTexParameters (per texture object state!), glTexImage. glDeleteTextures at program exit.

Then during display list build only put the glBindTexture with the tetxure object ID inside the list.
(That way you could even exchange the textures and leave the display list untouched.)

thanks much,
i’ll do that