PDA

View Full Version : sharing texture data across several texture id



PeterP
06-04-2003, 04:31 AM
Hi,

Is it possible to share the raw image data across two textures?

Ie, it's the same bitmap but one of the textures use:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);


and the second use:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, yellow);


Cheers,
Pete

jide
06-04-2003, 04:53 AM
it could. But against efficiency, i don't promise anything. It's best to make 2 or more different id and to store them into dlists;

Relic
06-06-2003, 04:10 AM
Switching between texture objects with different parameters need to switch the parameters in the texture unit anyway, so if you're concerned about texture size (e.g. 16 MB each), don't use two texture objects but switch the parameters yourself. It is an additional overhead per switch, but nothing compared to the time needed to page textures. If they are small, well, bench it.