Bump Mapping Help
I'm trying to do some basic bump mapping, and i keep getting this error
'GL_DOT3_RGBA_EXT' : undeclared identifier
Can someone please tell me what's wrong, here's my code:
Another Question: What does all of glTexEnv parameters that i'm using means? i don't fully understand them, i just learned to use them by trial and error from other codes
gluLookAt(0,0,4,0,0,0,0,1,0);
glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, decalTexture);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
glEnable(GL_TEXTURE_2D);
if (BumpMap)
{
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, normalMap);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGBA_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);
glEnable(GL_TEXTURE_2D);
}
glBegin(GL_QUADS);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0f, 1.0f);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 0.0f);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0f, 0.0f);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0f, 0.0f);
glVertex3f( 1.0f, -1.0f, 0.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, 0.0f, 1.0f);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 0.0f);
glEnd();
glActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
The undeclared identifier is because you're using an old version of the gl.h (1.1?), which donesn't know the value of GL_DOT3_RGBA_EXT, which is 0x8741. Well, most have the old 1.1 because that's what was shipped with the compilers, you just need a glext.h which is available from many places including http://g3d-cpp.sourceforge.net/html/glext_8h.html
Or if you can't handle inclulding glext.h, simply define the symbol in one of your headers or in the beginning of your source file
In the long run, if you have to use many other extensions, you should try to look for the reasons why including glext.h doesn't work.
#ifndef GL_DOT3_RGBA_EXT#define GL_DOT3_RGBA_EXT 0x8741#endif
In the long run, if you have to use many other extensions, you should try to look for the reasons why including glext.h doesn't work.
I switched from _EXT to _ARB and everything worked fine, this is weird
Thanks for the help guys
Thanks for the help guys
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement