When are textures loaded?

It is my understanding that textures are loaded onto the video card when a gluBuildMipmaps occurs. But how is this managed? In other words what if the texture memory on the card fills up (does gluBiuldMipmaps 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

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.

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.gluBuildMipmaps 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.