* GLUT_SINGLE now should behave more or less correctly.
   Thanks to Brian Paul!

 * Sleeping is now cognizant of outstanding redisplays.

 * Fractals_random has been restored more or less to as-before, save that
   it uses the more minimal glFlush() rather than glutSwapBuffers().
   glutSwapBuffers() was only required when freeglut was incorrectly
   handling promotion to double-buffering.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@202 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2003-09-23 01:03:41 +00:00
parent 4d8a8e7085
commit 93d944835a
3 changed files with 25 additions and 7 deletions

View File

@ -81,7 +81,7 @@ Display(void)
glPopMatrix(); glPopMatrix();
// glutSwapBuffers(); /* Should NOT be here... This is a Single-Buffered Program! */ glFlush();
glutPostRedisplay(); /* Needed so that this function will be called again */ glutPostRedisplay(); /* Needed so that this function will be called again */
} }
@ -236,10 +236,6 @@ void readConfigFile ( char *fnme )
} }
} }
void Idle(void) {
return;
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -266,7 +262,6 @@ main(int argc, char *argv[])
glutKeyboardFunc(Key); glutKeyboardFunc(Key);
glutSpecialFunc(Special); glutSpecialFunc(Special);
glutDisplayFunc(Display); glutDisplayFunc(Display);
glutIdleFunc(Idle);
glutMainLoop(); glutMainLoop();

View File

@ -454,6 +454,22 @@ static int fgHaveJoystick( void )
fgEnumWindows( fgCheckJoystickCallback, &enumerator ); fgEnumWindows( fgCheckJoystickCallback, &enumerator );
return !!enumerator.data; return !!enumerator.data;
} }
static void fgHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e)
{
if( w->State.Redisplay )
{
e->found = TRUE;
e->data = w;
}
}
static int fgHavePendingRedisplays (void)
{
SFG_Enumerator enumerator;
enumerator.found = FALSE;
enumerator.data = NULL;
fgEnumWindows( fgHavePendingRedisplaysCallback, &enumerator );
return !!enumerator.data;
}
/* /*
* Indicates whether there are any outstanding timers. * Indicates whether there are any outstanding timers.
*/ */
@ -490,6 +506,9 @@ static void fgSleepForEvents( void )
struct timeval wait; struct timeval wait;
long msec; long msec;
if( fgState.IdleCallback ||
fgHavePendingRedisplays() )
return;
socket = ConnectionNumber( fgDisplay.Display ); socket = ConnectionNumber( fgDisplay.Display );
FD_ZERO( &fdset ); FD_ZERO( &fdset );
FD_SET( socket, &fdset ); FD_SET( socket, &fdset );
@ -1227,7 +1246,7 @@ void FGAPIENTRY glutMainLoop( void )
*/ */
if ( fgStructure.Windows.First == NULL ) if ( fgStructure.Windows.First == NULL )
fgState.ExecState = GLUT_EXEC_STATE_STOP ; fgState.ExecState = GLUT_EXEC_STATE_STOP ;
else if( !fgState.IdleCallback ) else
fgSleepForEvents(); fgSleepForEvents();
} }

View File

@ -397,6 +397,10 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
*/ */
fgState.DisplayMode |= GLUT_DOUBLE ; fgState.DisplayMode |= GLUT_DOUBLE ;
window->Window.VisualInfo = fgChooseVisual(); window->Window.VisualInfo = fgChooseVisual();
/* OK, we got a double-buffered window, but we only wanted
* single-buffered. Clear the double-buffer flag now.
*/
fgState.DisplayMode &= ~GLUT_DOUBLE ;
} }
/* /*