| 1 | /* $Id: glut_swap.c,v 1.2 2000-02-09 08:46:17 jeroen Exp $ */
|
|---|
| 2 | /* Copyright (c) Mark J. Kilgard, 1994, 1997. */
|
|---|
| 3 |
|
|---|
| 4 | /* This program is freely distributable without licensing fees
|
|---|
| 5 | and is provided without guarantee or warrantee expressed or
|
|---|
| 6 | implied. This program is -not- in the public domain. */
|
|---|
| 7 |
|
|---|
| 8 | #include "glutint.h"
|
|---|
| 9 |
|
|---|
| 10 | /* CENTRY */
|
|---|
| 11 | void APIENTRY
|
|---|
| 12 | glutSwapBuffers(void)
|
|---|
| 13 | {
|
|---|
| 14 | GLUTwindow *window = __glutCurrentWindow;
|
|---|
| 15 |
|
|---|
| 16 | if (window->renderWin == window->win) {
|
|---|
| 17 | if (__glutCurrentWindow->treatAsSingle) {
|
|---|
| 18 | /* Pretend the double buffered window is single buffered,
|
|---|
| 19 | so treat glutSwapBuffers as a no-op. */
|
|---|
| 20 | return;
|
|---|
| 21 | }
|
|---|
| 22 | } else {
|
|---|
| 23 | if (__glutCurrentWindow->overlay->treatAsSingle) {
|
|---|
| 24 | /* Pretend the double buffered overlay is single
|
|---|
| 25 | buffered, so treat glutSwapBuffers as a no-op. */
|
|---|
| 26 | return;
|
|---|
| 27 | }
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | /* For the MESA_SWAP_HACK. */
|
|---|
| 31 | window->usedSwapBuffers = 1;
|
|---|
| 32 |
|
|---|
| 33 | SWAP_BUFFERS_LAYER(__glutCurrentWindow);
|
|---|
| 34 |
|
|---|
| 35 | /* I considered putting the window being swapped on the
|
|---|
| 36 | GLUT_FINISH_WORK work list because you could call
|
|---|
| 37 | glutSwapBuffers from an idle callback which doesn't call
|
|---|
| 38 | __glutSetWindow which normally adds indirect rendering
|
|---|
| 39 | windows to the GLUT_FINISH_WORK work list. Not being put
|
|---|
| 40 | on the list could lead to the buffering up of multiple
|
|---|
| 41 | redisplays and buffer swaps and hamper interactivity. I
|
|---|
| 42 | consider this an application bug due to not using
|
|---|
| 43 | glutPostRedisplay to trigger redraws. If
|
|---|
| 44 | glutPostRedisplay were used, __glutSetWindow would be
|
|---|
| 45 | called and a glFinish to throttle buffering would occur. */
|
|---|
| 46 | }
|
|---|
| 47 | /* ENDCENTRY */
|
|---|