View Full Version : MultiTexture error

09-11-2005, 07:39 PM
I'm programming in VisualC++ using
#include <GL\gl.h>
#include <GL\glut.h>

For my OpenGL includes. When I use
GL_ARB_multitexture is the first thing included in the string, but if I attempt to use

or any of it's related functions it gives me an 'undeclared identifier' error. code C2065. when I compile.

Does anyone know what I'm missing to be able to use the multitexturing functions?

09-11-2005, 08:19 PM
You need to include glext.h and bind the extension procs.

09-11-2005, 09:12 PM
Okay, I've always avoided messing with make files and stuff like that, so I need a little more help with how to bind the extension.

09-12-2005, 12:58 AM
You can use an extension wrapper like GLEW (http://glew.sourceforge.net/) to handle all the messy stuff for you.

09-12-2005, 03:36 PM
Thank you both for your help. And actually I think more detailed instructions on how to bind things, and what exactly needs binding in visualC++, would be most helpfull.

For one, it might come in handy later with more than just openGL extensions.

Also, I looked at the documentation for GLEW, it seems a little complicated to set up itself, no garantee that my program would be portable to another computer, and it does not work with GLUT unless I also use GLX.

I'll try it though if I can't figure out how to bind things myself.

09-12-2005, 11:45 PM
On many systems, you can get away with

#include <GL/gl.h>
#include <GL/glext.h>On some systems (windows in particular) however, you can't access extension function directly. You have to ask your system for function pointers and use those. This, however, is system (WGL/GLX/AGL) specific, and for all i know, glut doesn't provide a way to do it portably (as does SDL with SDL_GL_GetProcAddress for example).

Setting up the extension function pointers isn't that hard, but if you want to stay portable, you have to provide the code for all the different environments. Which is exactly what GLEW does (and a bit more).

#include <GL/gl.h>
#include <GL/glext.h>

#ifdef GL_ARB_multitexture
/* other extension functions */

void init_wgl(void) {
#ifdef GL_ARB_multitexture
PFNGLACTIVETEXTUREARB glActiveTextureARB = wglGetProcAddress("glActiveTextureARB");
}For other systems, substitute wglGetProcAddress with glXGetProcAddress or aglGetProcAddress.

And do yourself a favor and use a wrapper library.