From 2c52e17121abf4888117ab6b1c94be48ebd569c5 Mon Sep 17 00:00:00 2001 From: Eric Sandall Date: Wed, 2 Jul 2003 15:28:13 +0000 Subject: [PATCH] * Removed genfonts/genstrokes code, updated configure.in and Makefile.in * Moved tests/one.c into progs/demos/One/one.c, updated configure.in and Makefile.in git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@120 7f0cb862-5218-0410-a997-914c9d46530a --- ChangeLog | 9 ++ Makefile.am | 2 +- configure.in | 2 +- progs/demos/One/Makefile.am | 6 + progs/demos/One/one.c | 327 +++++++++++++++++++++++++++++++++++++++++++ tests/Makefile.am | 6 - tests/one.c | 327 ------------------------------------------- 7 files changed, 344 insertions(+), 335 deletions(-) create mode 100644 progs/demos/One/Makefile.am create mode 100644 progs/demos/One/one.c delete mode 100644 tests/Makefile.am delete mode 100644 tests/one.c diff --git a/ChangeLog b/ChangeLog index 642e178..fe594d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -198,3 +198,12 @@ October 24, 2002: ******************************************************************************************* (84) Fixed the 'ptr + len' problem in freeglut_misc.c:90 + + +******************************************************************************************* +* Changes on 02 July 2003 +******************************************************************************************* + +(85) Removed genfonts/genstrokes code, updated configure.in and Makefile.in + +(86) Moved tests/one.c into progs/demos/One/one.c, updated configure.in and Makefile.in diff --git a/Makefile.am b/Makefile.am index fdc20d9..93f606d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce makefile.im -SUBDIRS = src include genfonts tests +SUBDIRS = src include AUTOMAKE_OPTIONS = gnu EXTRA_DIST = AUTHORS COPYING ChangeLog INSTALL NEWS README TODO freeglut.lsm \ diff --git a/configure.in b/configure.in index ce5c570..6c81ed7 100644 --- a/configure.in +++ b/configure.in @@ -27,4 +27,4 @@ dnl Checks for library functions. AC_CHECK_LIBM AC_SUBST(LIBM) -AC_OUTPUT(Makefile src/Makefile include/Makefile include/GL/Makefile genfonts/Makefile tests/Makefile ) +AC_OUTPUT(Makefile src/Makefile include/Makefile include/GL/Makefile) diff --git a/progs/demos/One/Makefile.am b/progs/demos/One/Makefile.am new file mode 100644 index 0000000..ce09b09 --- /dev/null +++ b/progs/demos/One/Makefile.am @@ -0,0 +1,6 @@ +## Process this file with automake to produce Makefile.im + +bin_PROGRAMS = one +one_SOURCES = one.c +one_LDFLAGS = -export-dynamic -dlpreopen ../src/libfreeglut-2.0.la + diff --git a/progs/demos/One/one.c b/progs/demos/One/one.c new file mode 100644 index 0000000..6b22673 --- /dev/null +++ b/progs/demos/One/one.c @@ -0,0 +1,327 @@ +/* + * one.c + * + * Hey! This was the original file where freeglut development started. Just + * note what I have written here at the time. And see the creation date :) + * + * : This is a wrapper. I still have to figure out + * : how to build shared libraries under *nix :) + * + * Copyright (c) 1999 by Pawel W. Olszta + * Written by Pawel W. Olszta, + * Creation date: czw gru 2 11:58:41 CET 1999 + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "../include/GL/freeglut.h" + +int g_LeaveGameMode = 0; +int g_InGameMode = 1; + +/* + * Call this function to have some text drawn at given coordinates + */ +void PrintText( int nX, int nY, char* pszText ) +{ + int lines; + char *p; + + /* + * Prepare the OpenGL state + */ + glDisable( GL_DEPTH_TEST ); + glMatrixMode( GL_PROJECTION ); + glPushMatrix(); + glLoadIdentity(); + + /* + * Have an orthogonal projection matrix set + */ + glOrtho( 0, glutGet( GLUT_WINDOW_WIDTH ), + 0, glutGet( GLUT_WINDOW_HEIGHT ), + -1, +1 + ); + + /* + * Now the matrix mode + */ + glMatrixMode( GL_MODELVIEW ); + glPushMatrix(); + glLoadIdentity(); + + /* + * 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 ); + } + + /* + * Revert to the old matrix modes + */ + glMatrixMode( GL_PROJECTION ); + glPopMatrix(); + + glMatrixMode( GL_MODELVIEW ); + glPopMatrix(); + + /* + * Restore the old OpenGL states + */ + glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); + glEnable( GL_DEPTH_TEST ); +} + +/* + * This is the display routine for our sample FreeGLUT windows + */ +static float g_fTime = 0.0f; + +void SampleDisplay( void ) +{ + /* + * Clear the screen + */ + glClearColor( 0, 0.5, 1, 1 ); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + /* + * Have the cube rotated + */ + glMatrixMode( GL_MODELVIEW ); + glPushMatrix(); + + glRotatef( g_fTime, 0, 0, 1 ); + glRotatef( g_fTime, 0, 1, 0 ); + glRotatef( g_fTime, 1, 0, 0 ); + + /* + * And then drawn... + */ + glColor3f( 1, 1, 0 ); + //glutWireCube( 20.0 ); + glutWireTeapot( 20.0 ); + //glutWireSpher( 15.0, 15, 15 ); + //glColor3f( 0, 1, 0 ); + //glutWireCube( 30.0 ); + //glutSolidCone( 10, 20, 10, 2 ); + + /* + * Don't forget about the model-view matrix + */ + glPopMatrix(); + + /* + * Draw a silly text + */ + if( g_InGameMode == 0 ) + PrintText( 20, 20, "Hello there cruel world!" ); + else + PrintText( 20, 20, "Press ESC to leave the game mode!" ); + + /* + * And swap this context's buffers + */ + glutSwapBuffers(); +} + +/* + * This is a sample idle function + */ +void SampleIdle( void ) +{ + g_fTime += 0.5f; + + if( g_LeaveGameMode == 1 ) + { + glutLeaveGameMode(); + g_LeaveGameMode = 0; + g_InGameMode = 0; + } +} + +/* + * The reshape function + */ +void SampleReshape( int nWidth, int nHeight ) +{ + GLfloat fAspect = (GLfloat) nHeight / (GLfloat) nWidth; + GLfloat fPos[ 4 ] = { 0.0f, 0.0f, 10.0f, 0.0f }; + GLfloat fCol[ 4 ] = { 0.5f, 1.0f, 0.0f, 1.0f }; + + /* + * Update the viewport first + */ + glViewport( 0, 0, nWidth, nHeight ); + + /* + * Then the projection matrix + */ + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -fAspect, fAspect, 1.0, 80.0 ); + + /* + * Move back the camera a bit + */ + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -40.0f ); + + /* + * Enable some features... + */ + glEnable( GL_CULL_FACE ); + glEnable( GL_DEPTH_TEST ); + glEnable( GL_NORMALIZE ); + + /* + * Set up some lighting + */ + glLightfv( GL_LIGHT0, GL_POSITION, fPos ); + glEnable( GL_LIGHTING ); + glEnable( GL_LIGHT0 ); + + /* + * Set up a sample material + */ + glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, fCol ); +} + +/* + * A sample keyboard callback + */ +void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) +{ + printf( "SampleKeyboard(): keypress '%c' at (%i,%i)\n", cChar, nMouseX, nMouseY ); +} + +/* + * A sample keyboard callback (for game mode window) + */ +void SampleGameModeKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) +{ + if( cChar == 27 ) + g_LeaveGameMode = 1; +} + + +/* + * A sample special callback + */ +void SampleSpecial( int nSpecial, int nMouseX, int nMouseY ) +{ + printf( "SampleSpecial(): special keypress %i at (%i,%i)\n", nSpecial, nMouseX, nMouseY ); +} + +/* + * A sample menu callback + */ +void SampleMenu( int menuID ) +{ + /* + * Just print something funny + */ + printf( "SampleMenu() callback executed, menuID is %i\n", menuID ); +} + +/* + * The sample's entry point + */ +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 ); + + subMenuA = glutCreateMenu( SampleMenu ); + glutAddMenuEntry( "Sub menu A1 (01)", 1 ); + glutAddMenuEntry( "Sub menu A2 (02)", 2 ); + glutAddMenuEntry( "Sub menu A3 (03)", 3 ); + + subMenuB = glutCreateMenu( SampleMenu ); + glutAddMenuEntry( "Sub menu B1 (04)", 4 ); + glutAddMenuEntry( "Sub menu B2 (05)", 5 ); + glutAddMenuEntry( "Sub menu B3 (06)", 6 ); + glutAddSubMenu( "Going to sub menu A", subMenuA ); + + menuID = glutCreateMenu( SampleMenu ); + glutAddMenuEntry( "Entry one", 1 ); + glutAddMenuEntry( "Entry two", 2 ); + glutAddMenuEntry( "Entry three", 3 ); + glutAddMenuEntry( "Entry four", 4 ); + glutAddMenuEntry( "Entry five", 5 ); + glutAddSubMenu( "Enter sub menu A", subMenuA ); + glutAddSubMenu( "Enter sub menu B", subMenuB ); + + glutCreateWindow( "Hello world!" ); + glutDisplayFunc( SampleDisplay ); + glutReshapeFunc( SampleReshape ); + glutKeyboardFunc( SampleKeyboard ); + glutSpecialFunc( SampleSpecial ); + glutIdleFunc( SampleIdle ); + glutAttachMenu( GLUT_LEFT_BUTTON ); + + glutInitWindowPosition( 200, 200 ); + glutCreateWindow( "I am not Jan B." ); + glutDisplayFunc( SampleDisplay ); + glutReshapeFunc( SampleReshape ); + glutKeyboardFunc( SampleKeyboard ); + glutSpecialFunc( SampleSpecial ); + glutIdleFunc( SampleIdle ); + glutAttachMenu( GLUT_LEFT_BUTTON ); + + printf( "Testing game mode string parsing, don't panic!\n" ); + glutGameModeString( "320x240:32@100" ); + glutGameModeString( "640x480:16@72" ); + glutGameModeString( "1024x768" ); + glutGameModeString( ":32@120" ); + glutGameModeString( "Toudi glupcze, Danwin bedzie moj!" ); + glutGameModeString( "640x480:16@72" ); + + glutEnterGameMode(); + glutDisplayFunc( SampleDisplay ); + glutReshapeFunc( SampleReshape ); + glutKeyboardFunc( SampleGameModeKeyboard ); + glutIdleFunc( SampleIdle ); + 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 ) + ); + + /* + * Enter the main FreeGLUT processing loop + */ + glutMainLoop(); + + printf( "glutMainLoop() termination works fine!\n" ); + + /* + * This is never reached in FreeGLUT. Is that good? + */ + return( EXIT_SUCCESS ); +} + +/*** END OF FILE ***/ diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index ce09b09..0000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -## Process this file with automake to produce Makefile.im - -bin_PROGRAMS = one -one_SOURCES = one.c -one_LDFLAGS = -export-dynamic -dlpreopen ../src/libfreeglut-2.0.la - diff --git a/tests/one.c b/tests/one.c deleted file mode 100644 index 6b22673..0000000 --- a/tests/one.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * one.c - * - * Hey! This was the original file where freeglut development started. Just - * note what I have written here at the time. And see the creation date :) - * - * : This is a wrapper. I still have to figure out - * : how to build shared libraries under *nix :) - * - * Copyright (c) 1999 by Pawel W. Olszta - * Written by Pawel W. Olszta, - * Creation date: czw gru 2 11:58:41 CET 1999 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include "../include/GL/freeglut.h" - -int g_LeaveGameMode = 0; -int g_InGameMode = 1; - -/* - * Call this function to have some text drawn at given coordinates - */ -void PrintText( int nX, int nY, char* pszText ) -{ - int lines; - char *p; - - /* - * Prepare the OpenGL state - */ - glDisable( GL_DEPTH_TEST ); - glMatrixMode( GL_PROJECTION ); - glPushMatrix(); - glLoadIdentity(); - - /* - * Have an orthogonal projection matrix set - */ - glOrtho( 0, glutGet( GLUT_WINDOW_WIDTH ), - 0, glutGet( GLUT_WINDOW_HEIGHT ), - -1, +1 - ); - - /* - * Now the matrix mode - */ - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); - glLoadIdentity(); - - /* - * 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 ); - } - - /* - * Revert to the old matrix modes - */ - glMatrixMode( GL_PROJECTION ); - glPopMatrix(); - - glMatrixMode( GL_MODELVIEW ); - glPopMatrix(); - - /* - * Restore the old OpenGL states - */ - glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); - glEnable( GL_DEPTH_TEST ); -} - -/* - * This is the display routine for our sample FreeGLUT windows - */ -static float g_fTime = 0.0f; - -void SampleDisplay( void ) -{ - /* - * Clear the screen - */ - glClearColor( 0, 0.5, 1, 1 ); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - /* - * Have the cube rotated - */ - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); - - glRotatef( g_fTime, 0, 0, 1 ); - glRotatef( g_fTime, 0, 1, 0 ); - glRotatef( g_fTime, 1, 0, 0 ); - - /* - * And then drawn... - */ - glColor3f( 1, 1, 0 ); - //glutWireCube( 20.0 ); - glutWireTeapot( 20.0 ); - //glutWireSpher( 15.0, 15, 15 ); - //glColor3f( 0, 1, 0 ); - //glutWireCube( 30.0 ); - //glutSolidCone( 10, 20, 10, 2 ); - - /* - * Don't forget about the model-view matrix - */ - glPopMatrix(); - - /* - * Draw a silly text - */ - if( g_InGameMode == 0 ) - PrintText( 20, 20, "Hello there cruel world!" ); - else - PrintText( 20, 20, "Press ESC to leave the game mode!" ); - - /* - * And swap this context's buffers - */ - glutSwapBuffers(); -} - -/* - * This is a sample idle function - */ -void SampleIdle( void ) -{ - g_fTime += 0.5f; - - if( g_LeaveGameMode == 1 ) - { - glutLeaveGameMode(); - g_LeaveGameMode = 0; - g_InGameMode = 0; - } -} - -/* - * The reshape function - */ -void SampleReshape( int nWidth, int nHeight ) -{ - GLfloat fAspect = (GLfloat) nHeight / (GLfloat) nWidth; - GLfloat fPos[ 4 ] = { 0.0f, 0.0f, 10.0f, 0.0f }; - GLfloat fCol[ 4 ] = { 0.5f, 1.0f, 0.0f, 1.0f }; - - /* - * Update the viewport first - */ - glViewport( 0, 0, nWidth, nHeight ); - - /* - * Then the projection matrix - */ - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -fAspect, fAspect, 1.0, 80.0 ); - - /* - * Move back the camera a bit - */ - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -40.0f ); - - /* - * Enable some features... - */ - glEnable( GL_CULL_FACE ); - glEnable( GL_DEPTH_TEST ); - glEnable( GL_NORMALIZE ); - - /* - * Set up some lighting - */ - glLightfv( GL_LIGHT0, GL_POSITION, fPos ); - glEnable( GL_LIGHTING ); - glEnable( GL_LIGHT0 ); - - /* - * Set up a sample material - */ - glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, fCol ); -} - -/* - * A sample keyboard callback - */ -void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) -{ - printf( "SampleKeyboard(): keypress '%c' at (%i,%i)\n", cChar, nMouseX, nMouseY ); -} - -/* - * A sample keyboard callback (for game mode window) - */ -void SampleGameModeKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) -{ - if( cChar == 27 ) - g_LeaveGameMode = 1; -} - - -/* - * A sample special callback - */ -void SampleSpecial( int nSpecial, int nMouseX, int nMouseY ) -{ - printf( "SampleSpecial(): special keypress %i at (%i,%i)\n", nSpecial, nMouseX, nMouseY ); -} - -/* - * A sample menu callback - */ -void SampleMenu( int menuID ) -{ - /* - * Just print something funny - */ - printf( "SampleMenu() callback executed, menuID is %i\n", menuID ); -} - -/* - * The sample's entry point - */ -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 ); - - subMenuA = glutCreateMenu( SampleMenu ); - glutAddMenuEntry( "Sub menu A1 (01)", 1 ); - glutAddMenuEntry( "Sub menu A2 (02)", 2 ); - glutAddMenuEntry( "Sub menu A3 (03)", 3 ); - - subMenuB = glutCreateMenu( SampleMenu ); - glutAddMenuEntry( "Sub menu B1 (04)", 4 ); - glutAddMenuEntry( "Sub menu B2 (05)", 5 ); - glutAddMenuEntry( "Sub menu B3 (06)", 6 ); - glutAddSubMenu( "Going to sub menu A", subMenuA ); - - menuID = glutCreateMenu( SampleMenu ); - glutAddMenuEntry( "Entry one", 1 ); - glutAddMenuEntry( "Entry two", 2 ); - glutAddMenuEntry( "Entry three", 3 ); - glutAddMenuEntry( "Entry four", 4 ); - glutAddMenuEntry( "Entry five", 5 ); - glutAddSubMenu( "Enter sub menu A", subMenuA ); - glutAddSubMenu( "Enter sub menu B", subMenuB ); - - glutCreateWindow( "Hello world!" ); - glutDisplayFunc( SampleDisplay ); - glutReshapeFunc( SampleReshape ); - glutKeyboardFunc( SampleKeyboard ); - glutSpecialFunc( SampleSpecial ); - glutIdleFunc( SampleIdle ); - glutAttachMenu( GLUT_LEFT_BUTTON ); - - glutInitWindowPosition( 200, 200 ); - glutCreateWindow( "I am not Jan B." ); - glutDisplayFunc( SampleDisplay ); - glutReshapeFunc( SampleReshape ); - glutKeyboardFunc( SampleKeyboard ); - glutSpecialFunc( SampleSpecial ); - glutIdleFunc( SampleIdle ); - glutAttachMenu( GLUT_LEFT_BUTTON ); - - printf( "Testing game mode string parsing, don't panic!\n" ); - glutGameModeString( "320x240:32@100" ); - glutGameModeString( "640x480:16@72" ); - glutGameModeString( "1024x768" ); - glutGameModeString( ":32@120" ); - glutGameModeString( "Toudi glupcze, Danwin bedzie moj!" ); - glutGameModeString( "640x480:16@72" ); - - glutEnterGameMode(); - glutDisplayFunc( SampleDisplay ); - glutReshapeFunc( SampleReshape ); - glutKeyboardFunc( SampleGameModeKeyboard ); - glutIdleFunc( SampleIdle ); - 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 ) - ); - - /* - * Enter the main FreeGLUT processing loop - */ - glutMainLoop(); - - printf( "glutMainLoop() termination works fine!\n" ); - - /* - * This is never reached in FreeGLUT. Is that good? - */ - return( EXIT_SUCCESS ); -} - -/*** END OF FILE ***/ -- 1.7.10.4