View Full Version : gluBuild2DMipmaps in display list
07-13-2005, 04:07 AM
I have an algo that displays textures using the OpenGL 1.0 style (ie textures are encapsulated in display list).
I know i must use textures objects, but that's not done yet...
My question is that i'm using mipmaps by calling gluBuild2DMipmaps in the display list.
It works but i'm wondering if there is no problem by doing so ?
Why putting that function inside display lists ?
After thinking about it, I think you're safe doing it this way - using display lists for this is a very specific suggestion in the redbook, so it seems safe to do this, even when you use a glu function (which wraps the gl function and calculates the mipmaps).
Presumably the upload part is not repeated, so even if gluBuildMipmaps uses some main memory buffers you're not in trouble.
If that did not happen, you could never safely unload a texture from main memory in OpenGL1.0 before you were sure that it couldn't be called by a display list.
But still: yes, you should be using texture binding.
It's simple, and it's pretty much a necessity for more advanced stuff.
You call glGenTextures once per texture object (or call it once to get a whole range of IDs for multiple texture objects).
You then use glBindTexture to specify which texture you're going to upload.
You then use gluBuild2DMipmaps to actually upload it, you set texture parameters where necessary.
When you're ready to render, you just do a glBindTexture again and render your geometry.
All the texparameter settings (filtering, wrapping) are stored with the texture object.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.