Archived

This topic is now archived and is closed to further replies.

Lukerd

Simple Multi-Texturing Question

Recommended Posts

Lukerd    122
Hi After much fiddling I finally got hardware multitexturing working but there is a problem. All the stuff I draw that shouldn''t be multitextured, is multitextured. I guess I''m asking How Do You Turn Multitexturing Off? or is there another way? "To err is human, to really mess up requires a computer"

Share this post


Link to post
Share on other sites
siaspete    208
Sure you can turn it off, how did you turn it on?

// To enable multitexture:
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, tex0);
glEnable(GL_TEXTURE_2D);

glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, tex1);
glEnable(GL_TEXTURE_2D);

// To disable texturing for unit 1 only
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);

// To disable all texturing
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);

glActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);

Dare I say RTFM? ;-) Nah I daren''t, as the extension specs aren''t that nice to read. A good document is at:
http://www.berkelium.com/OpenGL/GDC99/multitexture.html

Hope this helps,

- Pete

Share this post


Link to post
Share on other sites
Brother Bob    10344
It''s (probably) because you don''t disable the extra texture units you use. When using multitexturing, you bind a texture to each unit and then enable it. And when you''re done, you must disable the units you no longer need.

  
glActiveTexture(GL_TEXTURE0); // select and activate first unit

glBindTExture(...);
glEnable(GL_TEXTURE_2D, ...);

glActiveTexture(GL_TEXTURE1); // select and activate second unit

glBindTExture(...);
glEnable(GL_TEXTURE_2D, ...);

// Use multitexturing here


glActiveTexture(GL_TEXTURE1); // might be rendurant, but just to show you how it works

glDisable(GL_TEXTURE_2D); // second texture unit is now disabled

Share this post


Link to post
Share on other sites
Lukerd    122
Thanks I didn''t realise that using glDisable(GL_TEXTURE_2D) that way only disabled that texture unit. I thought it would just disable all textures.

Thanks again.

Lukerd

"To err is human, to really mess up requires a computer"

Share this post


Link to post
Share on other sites