PDA

View Full Version : OpenGL 3.x/4.x headers on linux mint?



cellsheet
07-16-2013, 06:38 PM
Hello, when I am trying to create a program using GLFW 3.x (it was A PAIN to compile and work) on linux and syntax such as glGenVertexArrays(); they aren't being found. I have installed (barely managed) nvidia's 319 proprietary drivers for my GTX 760 graphics card with the --opengl-headers flag which installs the included gl.h. I also have ALL the dev files for OpenGL/mesa

Despite this, this is what I get:

main.cpp: In function ‘int main()’:
main.cpp:18:27: error: ‘glGenVertexArrays’ was not declared in this scope
main.cpp:19:35: error: ‘glBindBuffer’ was not declared in this scope


NOTE: GLFW 3.0 automatically loads GL/gl.h. I know it works since something like glClear(); is recognized. I can provide my code if needed.

If I include GL/glew.h before GLFW/glfw3.h (since glfw3 detects header includes put before it, and gives me a slew of additional errors if its put after glfw3) I will get this:

/tmp/ccUn7ZJ0.o: In function `main':
main.cpp: (.text+0x4b): undefined reference to `__glewGenVertexArrays'
main.cpp: (.text+0x5e): undefined reference to `__glewBindBuffer'

Running Linux Mint 15 olivia + GTX 760 (319 latest drivers from official site).

Thanks.

GClements
07-17-2013, 04:31 AM
main.cpp: In function ‘int main()’:
main.cpp:18:27: error: ‘glGenVertexArrays’ was not declared in this scope
main.cpp:19:35: error: ‘glBindBuffer’ was not declared in this scope

You need to define GL_GLEXT_PROTOTYPES before including <GL/gl.h> if you want prototypes for functions not in OpenGL 1.3. Otherwise, you just get typedefs for function pointers (for use with glXGetProcAddress).



If I include GL/glew.h before GLFW/glfw3.h (since glfw3 detects header includes put before it, and gives me a slew of additional errors if its put after glfw3) I will get this:

/tmp/ccUn7ZJ0.o: In function `main':
main.cpp: (.text+0x4b): undefined reference to `__glewGenVertexArrays'
main.cpp: (.text+0x5e): undefined reference to `__glewBindBuffer'


Are you linking with "-lGLEW"?

cellsheet
07-17-2013, 05:58 AM
I was not, thanks.