PDA

View Full Version : When are textures loaded?



tsewell
12-11-2002, 02:43 PM
It is my understanding that textures are loaded onto the video card when a gluBuild*Mipmaps occurs. But how is this managed? In other words what if the texture memory on the card fills up (does gluBiuld*Mipmaps return an error)? What about different rendering contexts, how/where are the textures for an old context stored when a context switch occurs? Is this all managed by the driver? Is there any method for interrogating the card for what textures are resident?

I'm experiencing a problem rendering with the same textures to different windows sharing a context and I'm not sure what is causing it.

thanks,
weston

tsewell
12-13-2002, 12:52 AM
If anyone cares, I just found a gl method that I had somehow overlooked:

glAreTexturesResident()

Queries the hardware to determine if the set of textures are resident (obviously). RTFM indeed.

zen
12-13-2002, 08:35 AM
Textures are loaded(not necessarily on VRAM) when an glTexImage* command is issued.Where the textures end up is driver dependent but if there's enough VRAM they should end up there(and be resident, although residency isn't defined as "in VRAM").If VRAM is full nothing will fail but some textures will be kept in(swapped out to) system RAM and will need to be reloaded to VRAM when they're bound.Therefore filling the VRAM will result in thrashing(lots of memory copying) and slow performance.gluBuild*Mipmaps is just a utility function that downsamples images and calls glTexImage* to upload them.
I've never tried multiple contexts so I'll just shut up now.