e-malito
e-malito

Reputation: 938

OpenGL compilation under debian - glGetUniformLocation not declared

I can't find a way to compile the following test code under Linux (part of a program developed for Mac)

#include<GL/glui.h>
void test(){
   const char *name
   GLint   uni_loc,x,y ;
   GLuint  id;
   glVertex2i( x, y);
   uni_loc = ::glGetUniformLocation(id, name) ;
}

I tried to compile it with:

g++ -c test.cpp -lglut -lGL -lGLU

g++ -c -lglut -lGL -lGLU test.cpp

I get a linker error for the glGetUniformLocation function:

 '::glGetUniformLocation' has not been declared

But don't know how to resolve it. I have no knowledge of openGl and get completely lost between the different implementations. I found the definition of the function in

  /usr/include/GL/gl_mangle.h
  /usr/include/GL/glew.h
  /usr/include/GL/glext.h

Could it be that I have the wrong version of GL?

I have the following packages installed:

  freeglut3 freeglut3-dev libglew1.5 libglew1.5-dev libglu1-mesa libglu1-mesa-dev libgl1-mesa-glx libgl1-mesa-dev mesa-common-dev

and gcc version 4.7.2 (Debian 4.7.2-5).

Upvotes: 0

Views: 721

Answers (1)

tbalazs
tbalazs

Reputation: 599

A portable way to get the functions defined in an extension is to use an extension wrapper like GLEW. A less robust way is to define GL_GLEXT_PROTOTYPES before including "GL/gl.h" and "GL/glext.h".

Upvotes: 2

Related Questions