#ifdef _WINDOWS_
/* need to check to see if the texture has been lost */
if(glOurTextureHasGone()) { }
#else
/* our sgi machine; do nothing, because it'll always be there */
#endif
so, the redundant copy is useless but only for a given implementation; but opengl is meant to abstract OVER the implementation.
In summary: as far as the programmer should be concerned WRT the opengl specs, once a texture is bound, then the system side of the mem can be safely deallocated. Wheter or not the opengl impl needs to copy that memory is up to the driver writers, and shouldn’t be part of the programmers job.
(As an analogy: some harddisks like parking their drive heads, or powering down. should we add some code to the C library so we can detect if the harddisk head has moved, and should MANUALLY realign it? no… of course not…)
I 100% agree that it is more work for the programmer. But dividing by 2 the texture memory usage worths it 10 times in my opinion. You don’t have to check all the textures each time you use them, probably once per frame is enough ?
well, checking them all the time IS what i mean by once per frame (since that’s when you’re going to use them).
No, i was proposing to keep only one copy: the one in video memory. Then if it no longer exists in video memory, you could know it with glIsLost, and upload it again youtself…
but where IS this magic copy that you pull out to repack video memory? if it’s not IN memory, then it must be on disk… so, you’re seriously advocating polling your plethroa of textures and reloading from disk any that are missing?
for a start, disk access is slow. Secondly, disk caches will probably store the texture in memory anyway (because you keep thrashing the texture file), and so you’ve automagically got your second copy; thirdly, you need to allocate memory to load the botmap from disk, THEN bind the texture and then free the texture memory (so, you spend a lot of your time with yet another copy of the texture) and thirdly, you’re doign a LOT of redundant checks to load in a LOT of textures from a slow resource.
the fact that your opengl driver feels it needs to copy texture memory isn’t opengl’s problem. it is an implementation detail because windows trashes vid mem.
cheers,
John
[This message has been edited by john (edited 04-01-2001).]