glDisable(GL_TEXTURE_2D);
where to call glDisable()?
hello everyone, i was just wondering if you were wanting to disable texture mapping after you texture map, where would you call it?
whenever i call it my texture doesn't display anymore. i know the code you should use is this:
i'm using win32 for my window, so should i call it inside my main message loop, or where i call initalize()? i would think i should call it at the end of my render function or something. when i don't disable texturing my color pixels get mixed up with my bitmap so the scene is really messed up.
thanks for the help:-)
Disable it when you want to render untextured objects and reenable it when you want to draw textured objects, i.e.:
Enigma
void render(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); drawUntexturedObject(); glEnable(GL_TEXTURE_2D); drawTexturedObject(); drawTexturedObject(); glDisable(GL_TEXTURE_2D); drawUntexturedObject();}
Enigma
As Enigma said, just place it after the objects with texture maps have been drawn, but be sure to reenable it before you try to start drawing textures again, it sounds like thats what you're forgetting.
thanks a bunch you guys, that fixed everything
one more question:
if i wanted to load 2 texture files into memory and texture map them onto different quads, how would i do that? i loaded 2 files into memory and have a separate .h file and separate function for each, but when i call their function, it only displays one of the texture files. how do i make sure that when i texture my ground, the sand texture shows up, and the background texture shows up in the background instead of the sand data?
thanks again
one more question:
if i wanted to load 2 texture files into memory and texture map them onto different quads, how would i do that? i loaded 2 files into memory and have a separate .h file and separate function for each, but when i call their function, it only displays one of the texture files. how do i make sure that when i texture my ground, the sand texture shows up, and the background texture shows up in the background instead of the sand data?
thanks again
Quote:Original post by lack the hackBind the background texture and render your background, then bind the sand texture and render your sand.
thanks a bunch you guys, that fixed everything
one more question:
if i wanted to load 2 texture files into memory and texture map them onto different quads, how would i do that? i loaded 2 files into memory and have a separate .h file and separate function for each, but when i call their function, it only displays one of the texture files. how do i make sure that when i texture my ground, the sand texture shows up, and the background texture shows up in the background instead of the sand data?
thanks again
glBindTexture(GL_TEXTURE_2D, bgTexName);RenderBackground();glBindTexture(GL_TEXTURE_2D, sandTexName);RenderSand();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement