Hi.
I started programming with OpenGL, and i made this little program bellow:
Code :#include"keyboard.h" 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) { cout<<"You pressed "<< key <<" button."<<endl; }Code :#ifndef __keyboard_h__ #define __keyboard_h__ #include<iostream> #include<GL/gl.h> #include<GL/glut.h> #include<GL/glx.h> using namespace std; class Keyboard { public: Keyboard(void); ~Keyboard(void); void keyPressed (unsigned char key, int x, int y); }; #endifCode :#include"keyboard.h" 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); glutInitWindowSize (500, 500); glutCreateWindow ("My first OpenGL Window"); glutKeyboardFunc(keypress_wrapper); glutMainLoop(); }I'm using glut or freeglut?Code ://To compile: //I'm using Debian Linux. g++ -o game keyboard.cpp main.cpp -lglut
I would like to use freeglut, here in this forum, some guy told me Glut is quite old.



Reply With Quote