OpenGL glActiveTexture is missing

Hello everyone.

I have ubuntu installed. And I am trying an OpenGL application. Far to know everything was ok. But today while trying multitexturing, I faced the following error.

error: %glActiveTexture% was not declared in this scope.

I checked on the GL/gl.h file [that I had included] and found the following declarations ::

GLAPI void GLAPIENTRY glActiveTexture( GLenum texture );
GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture);

But I don’t know for what reason, the program doesn’t compile.

In my searching, found a proposal to reinstall the mesa-common-dev package. But didn’t fix the problem.

If you have any idea, would be really helpfull.

glActivceTexture is spelled wrong…
glActiveTexture you have a ‘c’ that shouldn’t be there.

Sory about that. I couldn’t copy paste from my ssh-konsole, so I wrote it my self. The spelling mistake is not in my code.

gl.h should not have this prototype. glext.h should have prototypes, and should be this file here glext.h directly off the the OpenGL Registry page on this site. gl.h includes glext.h if you define GL_GLEXT_PROTOTYPES.

So all you should have to do is this:


#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>

Then just reference glActiveTexture.

gl.h should not have this prototype. glext.h should have prototypes, and should be this file here glext.h directly off the the OpenGL Registry page on this site. gl.h includes glext.h if you define GL_GLEXT_PROTOTYPES.

So all you should have to do is this:


#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>

Then just reference glActiveTexture.
[/QUOTE]

The gl.h provided by mesa seems not to include glext.h when GL_GLEXT_PROTOTYPES is defined. Instead you have to define GL_GLEXT_LEGACY if you want gl.h to include glext.h

So you may also need to include glext.h

After all day search finally found it.

I am using CUDA, and CUDA makefile for compiling my source code. For some reason CUDA uses its own include/GL/<GL_FILES>. And its gl.h wasn’t declaring glActiveTexture(). Instead have to include glew.h.

Now I have bumped with segmentation faults whenever I call glActiveTexture. But I hope that I will solve it.

Thanx all of you for your time and proposals.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.