Dunque...questa qui sembra essere compilabile.
Ma ovviamente la dichiarazione dei membri static la rende tutt'altro che una libreria...
In particolare la funzione display e quella della keyborad non puo' essere static...
codice:#include <windows.h> #include <GL/glut.h> #include <stdio.h> #include <stdlib.h> class MHwindow { private: int width; int height; //*char title; public: MHwindow(int, int); int getWidth(); int getHeight(); static void init(); static void display(); static void reshape(int, int); static void keyboard(unsigned char, int, int); } ; int MHwindow::getWidth(){return width;} int MHwindow::getHeight(){return height;} MHwindow::MHwindow(int w, int h) { width = w; height = h; } void MHwindow::display() { glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glPushMatrix ( ); glPopMatrix ( ); glutSwapBuffers ( ); } void MHwindow::reshape(int w, int h) { glViewport ( 0, 0, w, h ); glMatrixMode ( GL_PROJECTION ); glLoadIdentity ( ); if ( h==0 ) gluPerspective ( 80, ( float ) w, 1.0, 5000.0 ); else gluPerspective ( 80, ( float ) w / ( float ) h, 1.0, 5000.0 ); glMatrixMode ( GL_MODELVIEW ); glLoadIdentity ( ); } void MHwindow::keyboard ( unsigned char key, int x, int y ) { switch ( key ) { case 27: /* Escape key */ exit ( 0 ); break; case 'f': glutFullScreen ( ); break; case 'w': glutReshapeWindow ( 100,100 ); break; default: break; } } /* Main Loop * Open window with initial window size, title bar, * RGBA display mode, and handle input events. */ MHwindow MHgui(100,100); int main ( int argc, char** argv ) { glutInit ( &argc, argv ); glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE ); glutInitWindowSize ( MHgui.getWidth(),MHgui.getHeight() ); glutCreateWindow ( "pippo" ); glEnable ( GL_DEPTH_TEST ); glClearColor ( 0.0, 0.0, 0.0, 0.0 ); glutReshapeFunc ( MHgui.reshape ); glutKeyboardFunc ( MHgui.keyboard ); glutDisplayFunc ( MHgui.display ); glutMainLoop ( ); return 0; }

Rispondi quotando