Ticket #3191: glut3191.diff

File glut3191.diff, 1.5 KB (added by mysticmike, 15 years ago)
  • src/kits/opengl/glut/glutWindow.cpp

     
    364364void
    365365glutSwapBuffers()
    366366{
     367    // don't swap anything in single buffer mode
     368    if(gState.displayMode & GLUT_DOUBLE)
    367369    gState.currentWindow->SwapBuffers();
    368370}
    369371
  • src/kits/opengl/glut/glutEvent.cpp

     
    340340      gState.currentWindow->UnlockGL();
    341341}
    342342
     343// this stores the original display funcion
     344static GLUTdisplayCB __displayFunc;
     345
     346// new display function with swap buffers automagically appended
     347void __singleBufferDisplay(void)
     348{
     349  __displayFunc();
     350  gState.currentWindow->SwapBuffers();
     351}
     352
     353// switchs the display function
     354void __emulateSingleBuffer(void)
     355{
     356  __displayFunc = gState.currentWindow->display;
     357  gState.currentWindow->display = __singleBufferDisplay;
     358}
     359
    343360/***********************************************************
    344361 *  FUNCTION:   glutMainLoop (3.1)
    345362 *
     
    350367  if (!gState.windowListSize)
    351368    __glutFatalUsage("main loop entered with no windows created.");
    352369
     370    // Emulate single buffer for Haiku software renderer
     371    if(!(gState.displayMode & GLUT_DOUBLE))
     372          __emulateSingleBuffer();
     373
    353374  if(gState.currentWindow)
    354375      gState.currentWindow->UnlockGL();
    355376