Hello, i am trying to run the "triangle" from superbible5.
The code starts as :
Code :#include <GLTools.h> // OpenGL toolkit #include <GLShaderManager.h> // Shader Manager Class #ifdef __APPLE__ #include <glut/glut.h> #else #define FREEGLUT_STATIC #include <GL/glut.h> #endif // OS X version of GLUT // Windows FreeGlut equivalent GLBatch triangleBatch; GLShaderManager shaderManager; ...
The problem is that the compiler doesn't recognize the headers i described in the title of this topic.
If i run for example this code it runs ok! :
Code :* X86 compilation: gcc -o -L/usr/X11/lib main main.c -lGL -lX11 * X64 compilation: gcc -o -L/usr/X11/lib64 main main.c -lGL -lX11 */ #include <stdio.h> #include <stdlib.h> /* this includes the necessary X headers */ #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #include <GL/glx.h> #include <X11/X.h> /* X11 constant (e.g. TrueColor) */ #include <X11/keysym.h> void mydisplay() { glClear(GL_COLOR_BUFFER_BIT); //clear Display Window glFlush(); //necessary for processing OpenGL routines } void main(int argc, char **argv) { printf("Computational Physics - Computer Graphics - GV2007\n"); printf("Project >> BasicCode/code11.cpp\n"); printf("target : Graphic window initialization\n"); printf("--------------------------------------------------------\n"); glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB); glutCreateWindow("My graphic window"); GLfloat b=0.5; glClearColor(b,b,b,0); //set attribute : background color glutDisplayFunc(mydisplay); glutMainLoop(); }
I use code blocks and in order for the above to work , i added a link to "/usr/lib/libGLU.so and libGLUT.a.
Maybe i should do sth like that in that case??
Or maybe is a version issue?glxinfo | grep "OpenGL version"
OpenGL version string: 2.1.2 NVIDIA 270.29
And if it is how i will put the latest opengl???
Thank you!
EDIT-------------------------------------------------
Also,if i run the triangle from terminal it works fine!
Maybe from here someone can find a way??make Triangle
g++ -g -I/usr/include -I/usr/local/include -I/usr/include/GL -I../../../Src/GLTools/include/ -I../../../Src/GLTools/include/GL -o Triangle -L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib ../../../Src/Chapter02/Triangle/Triangle.cpp ../../../Src/GLTools/src/glew.c ../../../Src/GLTools/src/GLTools.cpp ../../../Src/GLTools/src/GLBatch.cpp ../../../Src/GLTools/src/GLTriangleBatch.cpp ../../../Src/GLTools/src/GLShaderManager.cpp ../../../Src/GLTools/src/math3d.cpp -lX11 -lglut -lGL -lGLU -lm



