diff options
author | José Fonseca <[email protected]> | 2008-02-28 15:53:13 +0900 |
---|---|---|
committer | José Fonseca <[email protected]> | 2008-02-28 15:53:13 +0900 |
commit | 2573f0e5d6f37f1a663bd472055babc97cfb3959 (patch) | |
tree | 30ca592eddf385cce61e43b88bd609797ba0bdc0 /src/glut/os2/glut_swap.cpp | |
parent | 2d8d472426eb487314ae608509989141933d6192 (diff) |
Convert crlf->lf line endings.
Windows/DOS users should enable core.autocrlf from now on.
Diffstat (limited to 'src/glut/os2/glut_swap.cpp')
-rw-r--r-- | src/glut/os2/glut_swap.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/src/glut/os2/glut_swap.cpp b/src/glut/os2/glut_swap.cpp index 210a7fc37e0..4831b8eb351 100644 --- a/src/glut/os2/glut_swap.cpp +++ b/src/glut/os2/glut_swap.cpp @@ -1,67 +1,67 @@ -
-/* Copyright (c) Mark J. Kilgard, 1994, 1997. */
-
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
- implied. This program is -not- in the public domain. */
-
-#include <stdio.h>
-#include "glutint.h"
-
-GLint __glutFPS = 0;
-GLint __glutSwapCount = 0;
-GLint __glutSwapTime = 0;
-
-/* CENTRY */
-void GLUTAPIENTRY
-glutSwapBuffers(void)
-{
- GLUTwindow *window = __glutCurrentWindow;
-
- if (window->renderWin == window->win) {
- if (__glutCurrentWindow->treatAsSingle) {
- /* Pretend the double buffered window is single buffered,
- so treat glutSwapBuffers as a no-op. */
- return;
- }
- } else {
- if (__glutCurrentWindow->overlay->treatAsSingle) {
- /* Pretend the double buffered overlay is single
- buffered, so treat glutSwapBuffers as a no-op. */
- return;
- }
- }
-
- /* For the MESA_SWAP_HACK. */
- window->usedSwapBuffers = 1;
-
- SWAP_BUFFERS_LAYER(__glutCurrentWindow);
-
- /* I considered putting the window being swapped on the
- GLUT_FINISH_WORK work list because you could call
- glutSwapBuffers from an idle callback which doesn't call
- __glutSetWindow which normally adds indirect rendering
- windows to the GLUT_FINISH_WORK work list. Not being put
- on the list could lead to the buffering up of multiple
- redisplays and buffer swaps and hamper interactivity. I
- consider this an application bug due to not using
- glutPostRedisplay to trigger redraws. If
- glutPostRedisplay were used, __glutSetWindow would be
- called and a glFinish to throttle buffering would occur. */
-
- if (__glutFPS) {
- GLint t = glutGet(GLUT_ELAPSED_TIME);
- __glutSwapCount++;
- if (__glutSwapTime == 0)
- __glutSwapTime = t;
- else if (t - __glutSwapTime > __glutFPS) {
- float time = 0.001 * (t - __glutSwapTime);
- float fps = (float) __glutSwapCount / time;
- fprintf(stderr, "GLUT: %d frames in %.2f seconds = %.2f FPS\n",
- __glutSwapCount, time, fps);
- __glutSwapTime = t;
- __glutSwapCount = 0;
- }
- }
-}
-/* ENDCENTRY */
+ +/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +#include <stdio.h> +#include "glutint.h" + +GLint __glutFPS = 0; +GLint __glutSwapCount = 0; +GLint __glutSwapTime = 0; + +/* CENTRY */ +void GLUTAPIENTRY +glutSwapBuffers(void) +{ + GLUTwindow *window = __glutCurrentWindow; + + if (window->renderWin == window->win) { + if (__glutCurrentWindow->treatAsSingle) { + /* Pretend the double buffered window is single buffered, + so treat glutSwapBuffers as a no-op. */ + return; + } + } else { + if (__glutCurrentWindow->overlay->treatAsSingle) { + /* Pretend the double buffered overlay is single + buffered, so treat glutSwapBuffers as a no-op. */ + return; + } + } + + /* For the MESA_SWAP_HACK. */ + window->usedSwapBuffers = 1; + + SWAP_BUFFERS_LAYER(__glutCurrentWindow); + + /* I considered putting the window being swapped on the + GLUT_FINISH_WORK work list because you could call + glutSwapBuffers from an idle callback which doesn't call + __glutSetWindow which normally adds indirect rendering + windows to the GLUT_FINISH_WORK work list. Not being put + on the list could lead to the buffering up of multiple + redisplays and buffer swaps and hamper interactivity. I + consider this an application bug due to not using + glutPostRedisplay to trigger redraws. If + glutPostRedisplay were used, __glutSetWindow would be + called and a glFinish to throttle buffering would occur. */ + + if (__glutFPS) { + GLint t = glutGet(GLUT_ELAPSED_TIME); + __glutSwapCount++; + if (__glutSwapTime == 0) + __glutSwapTime = t; + else if (t - __glutSwapTime > __glutFPS) { + float time = 0.001 * (t - __glutSwapTime); + float fps = (float) __glutSwapCount / time; + fprintf(stderr, "GLUT: %d frames in %.2f seconds = %.2f FPS\n", + __glutSwapCount, time, fps); + __glutSwapTime = t; + __glutSwapCount = 0; + } + } +} +/* ENDCENTRY */ |