• Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    eliot
    Posts: 645 from 2004/4/15
    Hi,

    just tested a very small example:

    Code:

    #include <iostream>
    #include <GL/gl.h>
    #include <GL/glut.h>

    using namespace std;

    class GlutView {
    public:
    GlutView() {
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(640, 480);
    glutInitWindowPosition(0, 0);
    glutCreateWindow("Test");
    glutDisplayFunc(GlutView::display_);
    glutKeyboardFunc(GlutView::keyPressedEvent_);
    glutSpecialFunc(GlutView::specialKeyPressedEvent_);
    glutMainLoop();
    }


    static void display_() {
    glClear(GL_COLOR_BUFFER_BIT);
    glutWireTeapot(0.5);
    glutSwapBuffers();

    }

    static void keyPressedEvent_(unsigned char key, int x, int y) {
    cout << "keyPressedEvent_: key=" << (int) key << ", x=" << x << ", y=" << y << endl;
    }

    static void specialKeyPressedEvent_(int key, int x, int y) {
    cout << "keyPressedEvent_: key=" << key << ", x=" << x << ", y=" << y << endl;
    }

    };

    int main(int argc, char **argv) {
    glutInit(&argc, argv);
    GlutView v;
    return 0;
    }


    compiled with: g++ TestGlut.cpp -std=c++11 -O0 -noixemul -I lib/include -lm -lGl -lglut

    It works well!
    In my project I do some more things (glut timer and idle function).
    I will check if it makes something strange.
    Good to know that the basics are working well. I will go on look for the reason
    If I know what's going wrong I will reply here!
    regards
    eliot
  • »01.02.16 - 16:51
    Profile