glDelete?

When do I need to call glDeleteTextures/Buffers? Program exit/res change?

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.
(MSDN Library)

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.

OK, that’s what I allready know 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:
glGenTex(1,&id);
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.

I don’t know what happens, I change resolution only at program startup and quit.
sorry

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).]