Jump to content
  • Advertisement
Sign in to follow this  
dletozeun

OpenGL problems with glTexEnv*()

This topic is 4823 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

Hello, ( I hope you will understand me lol!) I try to use opengl extension for multitexturing to blend a terrain on textures transitions... I set 2 textures with glTexEnv : glActiveTextureARB( GL_TEXTURE0_ARB ); glEnable( GL_TEXTURE_2D ); glBindTexture(GL_TEXTURE_2D,nom[0]); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE); glActiveTextureARB( GL_TEXTURE1_ARB ); glEnable( GL_TEXTURE_2D ); glBindTexture(GL_TEXTURE_2D,nom[1]); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB ); glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB ); glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE ); glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR_ARB ); glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB ); In fact i would blend edges of a grass texture with a soil texture that is applied when the program starts. But with these parameters i see the soil texture only! And the lighting disappears! And I don't understand why! when i draw the scene I do this: glMultiTexCoord2fARB( GL_TEXTURE0_ARB,u,v); glMultiTexCoord2fARB( GL_TEXTURE1_ARB,u,v); glColor3f(rgb,rgb,rgb); glVertex3f(x,y,z); rgb value is between 0 and 1 and I thought it is the factor when source0 and source1 are blended...but it seems to be wrong... thank you.

Share this post


Link to post
Share on other sites
Advertisement
Try inserting

glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_COLOR );

into your setup for GL_TEXTURE1_ARB, see if that helps...

Share this post


Link to post
Share on other sites
thank you for your reply! It works better with
glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_COLOR );

I have a mix between grass and soil textures but it is not homogeneous...
In fact the mix depend of ligting. If a zone is very lighted I see only the soil texture, in a zone that is not lighted i see only the grass texture and in the zone in half light i see a mix between the 2 textures...

It really strange..

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!