X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=progs%2Fdemos%2FOne%2Fone.c;h=7d609db66604f1d768d2b3a19b4e648644188098;hb=13bc069810e3f513a9aa6cd44e8a37d02c7baabf;hp=6b226737c6e20b861ef1e078e4cc4ca24761a2e6;hpb=2c52e17121abf4888117ab6b1c94be48ebd569c5;p=freeglut diff --git a/progs/demos/One/one.c b/progs/demos/One/one.c index 6b22673..7d609db 100644 --- a/progs/demos/One/one.c +++ b/progs/demos/One/one.c @@ -19,7 +19,7 @@ #include #include -#include "../include/GL/freeglut.h" +#include int g_LeaveGameMode = 0; int g_InGameMode = 1; @@ -44,8 +44,8 @@ void PrintText( int nX, int nY, char* pszText ) * Have an orthogonal projection matrix set */ glOrtho( 0, glutGet( GLUT_WINDOW_WIDTH ), - 0, glutGet( GLUT_WINDOW_HEIGHT ), - -1, +1 + 0, glutGet( GLUT_WINDOW_HEIGHT ), + -1, +1 ); /* @@ -56,22 +56,22 @@ void PrintText( int nX, int nY, char* pszText ) glLoadIdentity(); /* - * Now the main text + * Now the main text */ glColor3ub( 0, 0, 0 ); glRasterPos2i( nX, nY ); for( p=pszText, lines=0; *p; p++ ) { - if( *p == '\n' ) - { - lines++; - glRasterPos2i( nX, nY-(lines*18) ); - } - - glutBitmapCharacter( GLUT_BITMAP_HELVETICA_18, *p ); + if( *p == '\n' ) + { + lines++; + glRasterPos2i( nX, nY-(lines*18) ); + } + + glutBitmapCharacter( GLUT_BITMAP_HELVETICA_18, *p ); } - + /* * Revert to the old matrix modes */ @@ -115,8 +115,8 @@ void SampleDisplay( void ) * And then drawn... */ glColor3f( 1, 1, 0 ); - //glutWireCube( 20.0 ); - glutWireTeapot( 20.0 ); + //glutWireCube( 20.0 ); + glutWireTeapot( 20.0 ); //glutWireSpher( 15.0, 15, 15 ); //glColor3f( 0, 1, 0 ); //glutWireCube( 30.0 ); @@ -125,20 +125,20 @@ void SampleDisplay( void ) /* * Don't forget about the model-view matrix */ - glPopMatrix(); + glPopMatrix( ); /* * Draw a silly text */ if( g_InGameMode == 0 ) - PrintText( 20, 20, "Hello there cruel world!" ); + PrintText( 20, 20, "Hello there cruel world!" ); else - PrintText( 20, 20, "Press ESC to leave the game mode!" ); + PrintText( 20, 20, "Press ESC to leave the game mode!" ); /* * And swap this context's buffers */ - glutSwapBuffers(); + glutSwapBuffers( ); } /* @@ -150,9 +150,9 @@ void SampleIdle( void ) if( g_LeaveGameMode == 1 ) { - glutLeaveGameMode(); + glutLeaveGameMode( ); g_LeaveGameMode = 0; - g_InGameMode = 0; + g_InGameMode = 0; } } @@ -181,7 +181,7 @@ void SampleReshape( int nWidth, int nHeight ) * Move back the camera a bit */ glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); + glLoadIdentity( ); glTranslatef( 0.0, 0.0, -40.0f ); /* @@ -209,7 +209,8 @@ void SampleReshape( int nWidth, int nHeight ) */ void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) { - printf( "SampleKeyboard(): keypress '%c' at (%i,%i)\n", cChar, nMouseX, nMouseY ); + printf( "SampleKeyboard(): keypress '%c' at (%i,%i)\n", + cChar, nMouseX, nMouseY ); } /* @@ -218,7 +219,7 @@ void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) void SampleGameModeKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) { if( cChar == 27 ) - g_LeaveGameMode = 1; + g_LeaveGameMode = 1; } @@ -227,7 +228,8 @@ void SampleGameModeKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) */ void SampleSpecial( int nSpecial, int nMouseX, int nMouseY ) { - printf( "SampleSpecial(): special keypress %i at (%i,%i)\n", nSpecial, nMouseX, nMouseY ); + printf( "SampleSpecial(): special keypress %i at (%i,%i)\n", + nSpecial, nMouseX, nMouseY ); } /* @@ -248,12 +250,12 @@ int main( int argc, char** argv ) { int menuID, subMenuA, subMenuB; - glutInit( &argc, argv ); - glutInitDisplayString( "stencil~2 rgb double depth>=16 samples" ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); glutInitWindowPosition( 100, 100 ); + glutInit( &argc, argv ); + subMenuA = glutCreateMenu( SampleMenu ); glutAddMenuEntry( "Sub menu A1 (01)", 1 ); glutAddMenuEntry( "Sub menu A2 (02)", 2 ); @@ -307,9 +309,9 @@ int main( int argc, char** argv ) glutAttachMenu( GLUT_LEFT_BUTTON ); printf( "current window is %ix%i+%i+%i", - glutGet( GLUT_WINDOW_X ), glutGet( GLUT_WINDOW_Y ), - glutGet( GLUT_WINDOW_WIDTH ), glutGet( GLUT_WINDOW_HEIGHT ) - ); + glutGet( GLUT_WINDOW_X ), glutGet( GLUT_WINDOW_Y ), + glutGet( GLUT_WINDOW_WIDTH ), glutGet( GLUT_WINDOW_HEIGHT ) + ); /* * Enter the main FreeGLUT processing loop @@ -321,7 +323,7 @@ int main( int argc, char** argv ) /* * This is never reached in FreeGLUT. Is that good? */ - return( EXIT_SUCCESS ); + return EXIT_SUCCESS; } /*** END OF FILE ***/