Archived

This topic is now archived and is closed to further replies.

Little Bump Mapping Problem (very strange)

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

Hi there I've made a little opengl application which use Dot3 bump mapping (3 extensions needed : EXT_Texture_Env_Combine, EXT_Texture_Env_Dot3, ARB_Multitexture ) but I've got a little problem. The bump mapping process works, but textures colors are very strange... Hum I think the best way is to show you some screenshots : Screen 1 Screen 2 Ok so as you can see, the bump mapping works except on the strange color problem... Here is my rendering code :
      private final void render()
      {
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
            glLoadIdentity();

            glTranslatef(0.0f,0.0f,-5.0f);
            glRotatef(rotY, 0.0f, 1.0f, 0.0f);

            glActiveTextureARB(GL_TEXTURE0_ARB);
            glBindTexture(GL_TEXTURE_2D, texture2);
            glEnable(GL_TEXTURE_2D);

            glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
            glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGB_EXT);
            glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PRIMARY_COLOR_EXT);
            glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
            glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
            glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
            
            glActiveTextureARB(GL_TEXTURE1_ARB);
            glBindTexture(GL_TEXTURE_2D, texture);
            glEnable(GL_TEXTURE_2D);

            glBegin(GL_QUADS);
                  glNormal3f( 0.0f, 0.0f, 1.0f);
                  glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  0.0f);
			glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  0.0f);
			glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f); glVertex3f( 1.0f,  1.0f,  0.0f);
			glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f); glVertex3f(-1.0f,  1.0f,  0.0f);
            glEnd();

            glActiveTextureARB(GL_TEXTURE1_ARB);
            glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
            glDisable(GL_TEXTURE_2D);

            glActiveTextureARB(GL_TEXTURE0_ARB);
            glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
            glDisable(GL_TEXTURE_2D);
      }
Note: "texture" is the base texture and "texture2" is the bump map. Can someone help me ? Thanks in advance Chman [edited by - Chman_a11w on April 23, 2004 10:21:50 AM]

Share this post


Link to post
Share on other sites