View Full Version : glDelete?
09-04-2003, 10:00 PM
When do I need to call glDeleteTextures/Buffers? Program exit/res change?
09-04-2003, 11:21 PM
The glDeleteTextures function deletes n textures named by the elements of the array textures. After a texture is deleted, it has no contents or dimensionality, and its name is free for reuse (for example, by glGenTextures). The glDeleteTextures function ignores zeros and names that do not correspond to existing textures.
That means if you no longer need an array of texture names (generated by glGenTextures) just delete 'em.
Ex: you can create a texture array for the car you are using, one for the race level, one for the GUI, and so on. When the race ends call glDelete and reload the Main GUI textures.
09-05-2003, 12:53 AM
OK, that's what I allready know http://www.opengl.org/discussion_boards/ubb/biggrin.gif glGenTextures returns unsigned int which is identiflier for a texture, but what happens when I change res, the variable 'I am generating texture to' keeps the value when I change res, but what happens with the real texture? As far as I remember textures don't survive after res change...
So is this valid:
SGIS gen stuff
glTexture2D(bla, bla, bla);
after res change:
SGIS gen stuff
glSubImage2D(bla, bla, bla);
as far as I've seen in my project I must gen new val to id & can't use SubImg after res change, but do I need to call deltex before reschange, same applies to VBO.
09-05-2003, 03:25 AM
I don't know what happens, I change resolution only at program startup and quit.
http://www.opengl.org/discussion_boards/ubb/frown.gif http://www.opengl.org/discussion_boards/ubb/frown.gif http://www.opengl.org/discussion_boards/ubb/frown.gif
09-05-2003, 05:34 AM
GL is supposed to manage everything itself. A screen resolution change should not screw your textures. What would be the reason for losing textures anyway? Framebuffer re-allocation & stuff? If textures need to be paged out to system memory, so be it. The driver should be able to do this by itself.
I looked quickly at the spec and couldn't find a single reference to screen resolution change. While it has obvious effects on the framebuffer (wrt pixel ownership), I don't see why it would affect textures, apart from potentially enforce some memory management, but that's the driver's job.
Texture names precisely avoid having to keep direct pointers to memory lumps which could be moved around by the driver. They should survive a screen res change.
EDIT : wording of one sentence
[This message has been edited by kehziah (edited 09-05-2003).]
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.