Jump to content
  • Advertisement
Sign in to follow this  
DaAnde

OpenGL opengl Multitexture problem

This topic is 3921 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am writing an engine for a game I am making for fun. I had everything working like models loading and getting textured and everything. My terrain looked crappy so I improved that by using multi texturing. Now all my other texturing is broken ie. Not showing up. Is there any way to change between using multi texturing and using single textures?

Share this post


Link to post
Share on other sites
Advertisement
EDIT: To further clarify what I mean. The code I use to render terrain textures is for example:

glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, TextureArray[0]);
glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, TextureArray[1]);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, tCoord[x][z][0], tCoord[x][z][1]);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0, 0);

To render every other texture in my game I use for example:

glBindTexture(GL_TEXTURE_2D, texture);
glTexCoord2f(1.0f, 1.0f);

Share this post


Link to post
Share on other sites
Quote:

To render every other texture in my game I use for example:

glBindTexture(GL_TEXTURE_2D, texture);
glTexCoord2f(1.0f, 1.0f);


Now the active texture unit is UNIT_1 if you did not change the current texture unit and
glTexCoord2f(1.0f, 1.0f);
will set the texture coordinates of UNIT_0. So before setting the texture coordinates make UNIT_0 the active unit.

glActiveTextureARB(GL_TEXTURE0_ARB);

Share this post


Link to post
Share on other sites
Beautiful...After I finish drawing my terrain just before i call glPopMatrix(); I set this glActiveTextureARB(GL_TEXTURE0_ARB); and everything now works...thank you very much! You have helped me not get a huge headache with such a quick fix!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!