GLSlang `glGetUniformLocationARB' undefined

Hello,
first of all, sorry for my bad english :slight_smile:
At the moment I’m trying to learn something about GLslang and I’m stuck at the first code example of the Orange-Book(“OpenGL Shading Language” by Randi J. Rost)
after compiling this piece of code:

GLint getUniLoc(GLhandleARB program, const GLcharARB *name)
{
GLint loc;
loc = glGetUniformLocationARB(program,name);

if(loc=-1)
cout<<"fehler..";

printOpenGLError();
return loc;
}  

kdevelop prints out this error-message:

main.cpp: In function `GLint getUniLoc(long unsigned int, const GLcharARB*)':
main.cpp:83: error: `glGetUniformLocationARB' undeclared (first use this
function)
main.cpp:83: error: (Each undeclared identifier is reported only once for each
function it appears in.)
main.cpp:88: error: `printOpenGLError' undeclared (first use this function)  

I’ve included “glext.h”, “GL.h” and “GLX.h” which I have copied from /usr/share/doc/NVIDIA_GLX-1.0/includes into /usr/include/ (using the newest nvidia-drivers(2.0-6111))

Do I have to include any other header-files or link any other libaries except of GL and GLX(-lGL -lGLX)?

Thank you and I hope you can help me :slight_smile:

Oh sorry I’ve just noticed that there is a GLslang-forum … can a mod please move the topic to this forum I think it fits better in the GLslang-forum.

By default the glext.h header only declares the function pointers for the extensions. You have to define a function pointer in your application and then load the address of the symbol into the pointer with glxGetProcAddress .

Alternatively you could do a #define GL_GLEXT_PROTOTYPES before you include glext.h and let the linker do the address loading for you. This should work for linux because you link directly to the GL provided by your gfx driver vendor. Note that this method has one main disadvantage when you want to distribute your application and one of the users has a GL library installed which doesn’t export all the symbols your program needs.

thank you
it’s compiling now :smiley:

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