PDA

View Full Version : Texture Downloading on to GPU



dimensionX
09-25-2005, 06:27 AM
NVIDIA Geforce 7800 GTX
Forceware 77.72 drivers

glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);

if(pixels == 0)
==> Is memory allocated for the texture on the GPU ? If not when is it allocated ?

if(pixels != 0)
==> Is memory allocated for the texture on the GPU or is it (pixels) buffered somewhere else (ex:- PCIExpress memory) ?

In either of the above cases, how to know if the memory is allocated on the GPU ?

In either case, is the memory allocate on the GPU when it is:
1) first used as a destination of an FBO
2) first time bound for texture mapping
3) first time it is bound and another glTexImage2D/glTexSubImage2D call is made

Overmind
09-26-2005, 01:26 AM
In OpenGL you can never be sure what type of memory you get and when exactly the memory is allocated. But you don't need to be concerned with it either. You have the guarantee that the memory is available after the glTexImage call returns, it doesn't matter when exactly it is allocated.

But for textures I think you can be fairly certain that you'll always get GPU memory (except when it's already full).