summaryrefslogtreecommitdiff
path: root/progs/demos
diff options
context:
space:
mode:
Diffstat (limited to 'progs/demos')
-rw-r--r--progs/demos/arbfplight.c6
-rw-r--r--progs/demos/arbocclude.c11
-rw-r--r--progs/demos/fogcoord.c4
3 files changed, 21 insertions, 0 deletions
diff --git a/progs/demos/arbfplight.c b/progs/demos/arbfplight.c
index d5508a6aa8..2173ae6fed 100644
--- a/progs/demos/arbfplight.c
+++ b/progs/demos/arbfplight.c
@@ -51,16 +51,20 @@ static void Redisplay( void )
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
if (PixelLight) {
+#if defined(GL_ARB_fragment_program)
glProgramLocalParameter4fvARB_func(GL_FRAGMENT_PROGRAM_ARB,
LIGHTPOS, LightPos);
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glEnable(GL_VERTEX_PROGRAM_ARB);
+#endif
glDisable(GL_LIGHTING);
}
else {
glLightfv(GL_LIGHT0, GL_POSITION, LightPos);
+#if defined(GL_ARB_fragment_program)
glDisable(GL_FRAGMENT_PROGRAM_ARB);
glDisable(GL_VERTEX_PROGRAM_ARB);
+#endif
glEnable(GL_LIGHTING);
}
@@ -298,6 +302,7 @@ static void Init( void )
glDeleteProgramsARB_func = (PFNGLDELETEPROGRAMSARBPROC) glutGetProcAddress("glDeleteProgramsARB");
assert(glDeleteProgramsARB_func);
+#if defined(GL_ARB_fragment_program)
/*
* Fragment program
*/
@@ -349,6 +354,7 @@ static void Init( void )
exit(0);
}
assert(glIsProgramARB_func(VertProg));
+#endif
/*
* Misc init
diff --git a/progs/demos/arbocclude.c b/progs/demos/arbocclude.c
index 3735f7de43..ddbb1f1b75 100644
--- a/progs/demos/arbocclude.c
+++ b/progs/demos/arbocclude.c
@@ -115,6 +115,7 @@ static void Display( void )
glScalef(0.3, 0.3, 1.0);
glRotatef(-90.0 * Xpos, 0, 0, 1);
+#if defined(GL_ARB_occlusion_query)
#if TEST_DISPLAY_LISTS
glNewList(10, GL_COMPILE);
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery);
@@ -152,6 +153,7 @@ static void Display( void )
/* turn off occlusion testing */
glColorMask(1, 1, 1, 1);
glDepthMask(GL_TRUE);
+#endif /* GL_ARB_occlusion_query */
/* draw the orange rect, so we can see what's going on */
glColor3f(0.8, 0.5, 0);
@@ -173,6 +175,7 @@ static void Display( void )
glLoadIdentity();
glColor3f(1, 1, 1);
+#if defined(GL_ARB_occlusion_query)
sprintf(s, " %4d Fragments Visible", passed);
glRasterPos3f(-0.50, -0.7, 0);
PrintString(s);
@@ -180,6 +183,10 @@ static void Display( void )
glRasterPos3f(-0.25, -0.8, 0);
PrintString("Fully Occluded");
}
+#else
+ glRasterPos3f(-0.25, -0.8, 0);
+ PrintString("GL_ARB_occlusion_query not available at compile time");
+#endif /* GL_ARB_occlusion_query */
glutSwapBuffers();
}
@@ -238,17 +245,21 @@ static void Init( void )
exit(-1);
}
+#if defined(GL_ARB_occlusion_query)
glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, &bits);
if (!bits) {
printf("Hmmm, GL_QUERY_COUNTER_BITS_ARB is zero!\n");
exit(-1);
}
+#endif /* GL_ARB_occlusion_query */
glGetIntegerv(GL_DEPTH_BITS, &bits);
printf("Depthbits: %d\n", bits);
+#if defined(GL_ARB_occlusion_query)
glGenQueriesARB(1, &OccQuery);
assert(OccQuery > 0);
+#endif /* GL_ARB_occlusion_query */
glEnable(GL_DEPTH_TEST);
}
diff --git a/progs/demos/fogcoord.c b/progs/demos/fogcoord.c
index 75a0835d4f..f4f8199efa 100644
--- a/progs/demos/fogcoord.c
+++ b/progs/demos/fogcoord.c
@@ -23,6 +23,10 @@
#define DEPTH 15.0f
+#if !defined(GLAPIENTRYP)
+# define GLAPIENTRYP *
+#endif
+
typedef void (GLAPIENTRYP GLFOGCOORDFEXTPROC) (GLfloat f);
typedef void (GLAPIENTRYP GLFOGCOORDPOINTEREXTPROC) (GLenum, GLsizei, const GLvoid *);