some saying that OpenGL is a STATE machine:you change the state, then the state will change from now on.

I want to map texture on some object and some not(just using material),so when drawing the object WITHOUT texture, the LAST glBindTexture always interrupt it(make it using the last Texture)

so I want to draw object with texture with glEnable(GL_TEXTURE_2D)
and draw object without texture with glDisable(GL_TEXTURE_2D)

but It Can't work!

so i found that some glXXX(like glEnable) command affect the whole Opengl environment,not like the glColor just affect the next draw object

Am i right?

jide

08-02-2005, 04:42 AM

If you disable texturing (glDisable (GL_TEXTURE2D)) before drawing an object you want untextured, it should be drawn untextured and that even if the object you're drawing has specified texture coordinates.
Don't forget to re-enable texturing after.

OpenGL has a state machine. Look at the opengl specs on this website to know more about them. You can use glPushAttrib, glPushClientAttrib and their matching Pop*Attrib to 'play' with states.

Komat

08-02-2005, 04:05 PM

Originally posted by aQ:
so i found that some glXXX(like glEnable) command affect the whole Opengl environment,not like the glColor just affect the next draw object
Each object is drawn using OpenGL state that was active at time drawing command for that object was issued unless there is bug in driver. glEnable and glColor are working in same way in this regard.