Skip to main content
GameDev.net gamedev.net
🔒 Locked

reset glTexEnviv

Started by choffstein Oct 13, 2005 at 12:56 AM 2 replies 550+ views
Original Post
choffstein
choffstein
So I am trying to get multitexturing working, and am having a big issue. I am enabling some stuff with my glTexEnv calls, which seem to be not only effecting my current model drawn, but all models afterwords. So I figure, for every glTexEnv call I make, I must reset it. The first problem is that I don't know all the defaults. I suppose I could perform some sort of glGet on the texture environment, but that seems silly. Also, I want it robust enough that I don't have to know exactly what changes were made. Like, I could have anyone sit down and call any glTexEnv they wanted to, and have to perfect right after. I am thinking something like ... glMatrixMode(GL_TEXTURE); glPushMatrix(); //do texEnv stuff //as well as disables and enables glMatrixMode(GL_MODELVIEW); ...draw stuff glMatrixMode(GL_TEXTURE); glPopMatrix(); Should that take care of it? Sorry, I am a bit of a noob here.
James Trotter
James Trotter
Quote:
Original post by visage
So I am trying to get multitexturing working, and am having a big issue. I am enabling some stuff with my glTexEnv calls, which seem to be not only effecting my current model drawn, but all models afterwords. So I figure, for every glTexEnv call I make, I must reset it.

The first problem is that I don't know all the defaults. I suppose I could perform some sort of glGet on the texture environment, but that seems silly.

Also, I want it robust enough that I don't have to know exactly what changes were made. Like, I could have anyone sit down and call any glTexEnv they wanted to, and have to perfect right after.

I am thinking something like ...

glMatrixMode(GL_TEXTURE);
glPushMatrix();
//do texEnv stuff
//as well as disables and enables
glMatrixMode(GL_MODELVIEW);
...draw stuff
glMatrixMode(GL_TEXTURE);
glPopMatrix();

Should that take care of it? Sorry, I am a bit of a noob here.


Well, that will reset the texture matrix, but not the states set by glTexEnv*. For that you will need to use glPushAttrib and glPopAttrib. In this case you need to push and pop the texture attribute group, and maybe also the current attribute group:

glPushAttrib(GL_TEXTURE_BIT | GL_CURRENT_BIT);
// glTexEnv* stuff, enables/disables...
glPopAttrib();
choffstein
choffstein
Thanks. I will do some research.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.