Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Problem with mainloop.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie
    Join Date
    Jan 2013

    [SOLVED]Problem with mainloop.

    Hello guys.
    I'm a newbie in OpenGL and i'm trying to make a program with keyboard events, just to make some tests.
    I'm using Linux Debian e g++ to compile the code which i'm making with c++.
    The problem is when i run my program, what i see is:
    Object created.
    Object killed with success.
    I thought the "main" method would be waiting i push a button on the keyboard. I'm saying this because of "glutMainLoop();".
    Why it doesn't happen, and the "glutMainLoop();" method does not enter in loop?
    Code :
    #ifndef __keyboard_h__
    #define __keyboard_h__
    using namespace std;
    class Keyboard
    		void keyPressed (unsigned char key, int x, int y);
    Code :
    Keyboard :: Keyboard(void)
    	cout<<"Object created."<<endl;
    Keyboard :: ~Keyboard(void)
    	cout<<"Object killed with success."<<endl;
    void Keyboard :: keyPressed(unsigned char key, int x, int y)
    		case 'j': cout<<"Nothing, just testing."<<endl;
    Code :
    Keyboard global_keyboard;
    void keypress_wrapper(unsigned char key, int x, int y)
       	global_keyboard.keyPressed(key, x, y);
    int main(int argc, char **argv)
    	glutInit(&argc, argv);

    To compile:
    g++ -o test main.cpp keyboard.cpp -lglut
    What i'm doing wrong?
    Last edited by robgeek; 01-23-2013 at 06:23 AM.

Posting Permissions

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