Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: opengl & linux -- "GLTools.h"&"GLShaderManager.h"

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2011
    Posts
    2

    opengl & linux -- "GLTools.h"&"GLShaderManager.h"

    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(&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??

  2. #2
    Junior Member Newbie
    Join Date
    Mar 2011
    Posts
    2

    Re: opengl & linux -- "GLTools.h"&"GLShaderManager.h"

    Hello, i did some progress..

    I copied from the freeglut directory from the
    superbible5
    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •