PDA

View Full Version : Bitmap Texturing



02-14-2002, 04:19 AM
How do I apply bitmap texture to some objects and not to the others

yakuza
02-14-2002, 05:17 AM
OpenGL is a state machine, so once you've bound a texture and enabled texturing, it is going to texture your objects until you either bind a new texture, or disable texturing. So, you should:
glEnable(GL_TEXTURE_2D);
and then draw the object that you want the texture on, and then:
glDisable(GL_TEXTURE_2D);
and then draw the object that you do not want to have a texture.

Hope that helps!

JLawson
02-14-2002, 05:20 AM
After you load the bitmap, you want to apply the bitmap to objects as textures.

I will assume that you know how to load the bitmap and generate the texture.

When you draw the object that you want texture-mapped, you need to call the following:

glBindTexture(GL_TEXTURE_2D, textureID);
glEnable(GL_TEXTURE_2D);
Draw_My_Textured_Object();
glDisable(GL_TEXTURE_2D);

Remember to enable GL_TEXTURE_2D somewhere during your PreRender code, also.

One thing you might try is to just disable texturing when you want to draw normal textures.

ex:

glDisable(GL_TEXTURE_2D);
Draw_nonTextured_Object();
glEnable(GL_TEXTURE_2D);


Hope that helps,
~Jesse