summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-09-17 08:40:24 -0600
committerBrian Paul <brianp@vmware.com>2010-09-17 10:01:28 -0600
commit59231a20aa9314bc6e4a5348b149ea76ffd0b44c (patch)
tree82634b34f0159b49e950d05fc940d4547203e5e1
parent2d848cc96116b20a24d2608e1003cfc65415f73e (diff)
arbocclude2: assorted clean-ups, indenting, etc
-rw-r--r--src/demos/arbocclude2.c119
1 files changed, 59 insertions, 60 deletions
diff --git a/src/demos/arbocclude2.c b/src/demos/arbocclude2.c
index aede5ef6..4ded8ff7 100644
--- a/src/demos/arbocclude2.c
+++ b/src/demos/arbocclude2.c
@@ -113,36 +113,17 @@ static void Display( void )
glEnd();
#if defined(GL_ARB_occlusion_query)
- glColorMask(0, 0, 0, 0);
+ /* disable all buffer updates */
+ glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDepthMask(GL_FALSE);
/* draw the first polygon with occlusion testing */
glPushMatrix();
- glTranslatef(Xpos, 0.4, -0.5);
- glScalef(0.3, 0.3, 1.0);
- glRotatef(-90.0 * Xpos, 0, 0, 1);
+ glTranslatef(Xpos, 0.4, -0.5);
+ glScalef(0.3, 0.3, 1.0);
+ glRotatef(-90.0 * Xpos, 0, 0, 1);
- glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery1);
-
- glBegin(GL_POLYGON);
- glVertex3f(-1, -1, 0);
- glVertex3f( 1, -1, 0);
- glVertex3f( 1, 1, 0);
- glVertex3f(-1, 1, 0);
- glEnd();
-
- glEndQueryARB(GL_SAMPLES_PASSED_ARB);
-
- /* draw the second polygon with occlusion testing */
- glPopMatrix();
-#endif
- glPushMatrix();
- glTranslatef(Xpos, -0.4, -0.5);
- glScalef(0.3, 0.3, 1.0);
-#if defined(GL_ARB_occlusion_query2)
- if (has_oq2) {
-
- glBeginQueryARB(GL_ANY_SAMPLES_PASSED, OccQuery2);
+ glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery1);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
@@ -151,56 +132,74 @@ static void Display( void )
glVertex3f(-1, 1, 0);
glEnd();
- glEndQueryARB(GL_ANY_SAMPLES_PASSED);
- }
+ glEndQueryARB(GL_SAMPLES_PASSED_ARB);
+ glPopMatrix();
#endif
- /* turn off occlusion testing */
- glColorMask(1, 1, 1, 1);
- glDepthMask(GL_TRUE);
+ /* draw the second polygon with occlusion testing */
+ glPushMatrix();
+ glTranslatef(Xpos, -0.4, -0.5);
+ glScalef(0.3, 0.3, 1.0);
+#if defined(GL_ARB_occlusion_query2)
+ if (has_oq2) {
+ glBeginQueryARB(GL_ANY_SAMPLES_PASSED, OccQuery2);
+
+ glBegin(GL_POLYGON);
+ glVertex3f(-1, -1, 0);
+ glVertex3f( 1, -1, 0);
+ glVertex3f( 1, 1, 0);
+ glVertex3f(-1, 1, 0);
+ glEnd();
-#if defined(GL_ARB_occlusion_query)
- do {
- /* do useful work here, if any */
- glGetQueryObjectivARB(OccQuery1, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
- } while (!ready);
- glGetQueryObjectuivARB(OccQuery1, GL_QUERY_RESULT_ARB, &passed1);
+ glEndQueryARB(GL_ANY_SAMPLES_PASSED);
+ }
#endif
-#if defined(GL_ARB_occlusion_query2)
- if (has_oq2) {
+
+ /* re-enable buffer updates */
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ glDepthMask(GL_TRUE);
+
+#if defined(GL_ARB_occlusion_query)
do {
/* do useful work here, if any */
- glGetQueryObjectivARB(OccQuery2, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
+ glGetQueryObjectivARB(OccQuery1, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
} while (!ready);
- glGetQueryObjectuivARB(OccQuery2, GL_QUERY_RESULT_ARB, &passed2_boolean);
- }
+ glGetQueryObjectuivARB(OccQuery1, GL_QUERY_RESULT_ARB, &passed1);
+#endif
+#if defined(GL_ARB_occlusion_query2)
+ if (has_oq2) {
+ do {
+ /* do useful work here, if any */
+ glGetQueryObjectivARB(OccQuery2, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
+ } while (!ready);
+ glGetQueryObjectuivARB(OccQuery2, GL_QUERY_RESULT_ARB, &passed2_boolean);
+ }
#endif /* GL_ARB_occlusion_query2 */
- /* draw the second rect, so we can see what's going on */
- glColor3f(0.8, 0.5, 0);
- if (has_oq2) {
+ /* draw the second rect, so we can see what's going on */
+ glColor3f(0.8, 0.5, 0);
+ if (has_oq2) {
+ glBegin(GL_POLYGON);
+ glVertex3f(-1, -1, 0);
+ glVertex3f( 1, -1, 0);
+ glVertex3f( 1, 1, 0);
+ glVertex3f(-1, 1, 0);
+ glEnd();
+ }
+ glPopMatrix();
+
+ glPushMatrix();
+ glTranslatef(Xpos, 0.4, -0.5);
+ glScalef(0.3, 0.3, 1.0);
+ glRotatef(-90.0 * Xpos, 0, 0, 1);
+
+ /* draw the first rect, so we can see what's going on */
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
- }
-
- glPopMatrix();
- glPushMatrix();
- glTranslatef(Xpos, 0.4, -0.5);
- glScalef(0.3, 0.3, 1.0);
- glRotatef(-90.0 * Xpos, 0, 0, 1);
-
- /* draw the first rect, so we can see what's going on */
- glBegin(GL_POLYGON);
- glVertex3f(-1, -1, 0);
- glVertex3f( 1, -1, 0);
- glVertex3f( 1, 1, 0);
- glVertex3f(-1, 1, 0);
- glEnd();
-
glPopMatrix();
/* Print result message */