PDA

View Full Version : opengl & linux -- "GLTools.h"&"GLShaderManager.h"



ggeo1
03-07-2011, 07:35 AM
Hello, i am trying to run the "triangle" from superbible5.
The code starts as :


#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! :


* 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(&amp;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??


glxinfo | grep "OpenGL version"
OpenGL version string: 2.1.2 NVIDIA 270.29

Or maybe is a version issue?
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!


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


Maybe from here someone can find a way??

ggeo1
03-07-2011, 08:39 AM
Hello, i did some progress..

I copied from the freeglut directory from the
superbible5 (http://www.starstonesoftware.com/OpenGL )
the *.h files into /usr/include/GL

and then it gave a message from the GLTools.h complaining about
include <glew.h> .I edited to "include <GL/glew.h>".
Then the compiler complained about math3d.h (this file is also in the direcory above)

"error: conflicting types for m3dLoadVector2"
The line which the error locates is :


inline void m3dLoadVector2(M3DVector2d v, const float x, const float y)

I don't know what to do next...

Any ideas?