summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Faye-Lund <erik.faye-lund@collabora.com>2023-03-08 09:12:02 +0100
committerErik Faye-Lund <erik.faye-lund@collabora.com>2023-03-13 08:39:26 +0100
commit9780885abc7f0320f46afe92172e94b415555c41 (patch)
treed117b3979a0ee967ba0edb0f41efa1d661f36844
parentf01418cac26210f0d219c526cfdb34f84c86df4b (diff)
downloadmesa-demos-9780885abc7f0320f46afe92172e94b415555c41.tar.gz
demos: require gl 2.0 headers
The GL_VERSION_X_Y defines tells us that we have an gl.h file that supports OpenGL X.Y. Considering it's been almost two decades since OpenGL 2.0 was released, let's just always assume that it's recent enough. Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
-rw-r--r--src/demos/dinoshade.c70
-rw-r--r--src/demos/glinfo.c2
-rw-r--r--src/demos/spriteblast.c6
3 files changed, 28 insertions, 50 deletions
diff --git a/src/demos/dinoshade.c b/src/demos/dinoshade.c
index ad0ef3de..f904813a 100644
--- a/src/demos/dinoshade.c
+++ b/src/demos/dinoshade.c
@@ -533,21 +533,17 @@ redraw(void)
to raise the depth of the projected shadow slightly so
that it does not depth buffer alias with the floor. */
if (offsetShadow) {
- switch (polygonOffsetVersion) {
- case EXTENSION:
-#ifdef GL_EXT_polygon_offset
- glEnable(GL_POLYGON_OFFSET_EXT);
- break;
-#endif
-#ifdef GL_VERSION_1_1
- case ONE_DOT_ONE:
- glEnable(GL_POLYGON_OFFSET_FILL);
- break;
-#endif
- case MISSING:
- /* Oh well. */
- break;
- }
+ switch (polygonOffsetVersion) {
+ case EXTENSION:
+ glEnable(GL_POLYGON_OFFSET_EXT);
+ break;
+ case ONE_DOT_ONE:
+ glEnable(GL_POLYGON_OFFSET_FILL);
+ break;
+ case MISSING:
+ /* Oh well. */
+ break;
+ }
}
/* Render 50% black shadow color on top of whatever the
@@ -567,21 +563,17 @@ redraw(void)
glEnable(GL_LIGHTING);
if (offsetShadow) {
- switch (polygonOffsetVersion) {
-#ifdef GL_EXT_polygon_offset
- case EXTENSION:
- glDisable(GL_POLYGON_OFFSET_EXT);
- break;
-#endif
-#ifdef GL_VERSION_1_1
- case ONE_DOT_ONE:
- glDisable(GL_POLYGON_OFFSET_FILL);
- break;
-#endif
- case MISSING:
- /* Oh well. */
- break;
- }
+ switch (polygonOffsetVersion) {
+ case EXTENSION:
+ glDisable(GL_POLYGON_OFFSET_EXT);
+ break;
+ case ONE_DOT_ONE:
+ glDisable(GL_POLYGON_OFFSET_FILL);
+ break;
+ case MISSING:
+ /* Oh well. */
+ break;
+ }
}
if (stencilShadow) {
glDisable(GL_STENCIL_TEST);
@@ -851,21 +843,15 @@ main(int argc, char **argv)
glutAttachMenu(GLUT_RIGHT_BUTTON);
makeDinosaur();
-#ifdef GL_VERSION_1_1
if (GLAD_GL_VERSION_1_1 && !forceExtension) {
polygonOffsetVersion = ONE_DOT_ONE;
glPolygonOffset(-2.0, -9.0);
- } else
-#endif
- {
-#ifdef GL_EXT_polygon_offset
- /* check for the polygon offset extension */
- if (GLAD_GL_EXT_polygon_offset) {
- polygonOffsetVersion = EXTENSION;
- glPolygonOffsetEXT(-2.0, -0.002);
- } else
-#endif
- {
+ } else {
+ /* check for the polygon offset extension */
+ if (GLAD_GL_EXT_polygon_offset) {
+ polygonOffsetVersion = EXTENSION;
+ glPolygonOffsetEXT(-2.0, -0.002);
+ } else {
polygonOffsetVersion = MISSING;
printf("\ndinoshine: Missing polygon offset.\n");
printf(" Expect shadow depth aliasing artifacts.\n\n");
diff --git a/src/demos/glinfo.c b/src/demos/glinfo.c
index 62bf5a36..103c1d5e 100644
--- a/src/demos/glinfo.c
+++ b/src/demos/glinfo.c
@@ -25,7 +25,6 @@ int main( int argc, char *argv[] )
printf("GL_VENDOR: %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS: %s\n", (char *) glGetString(GL_EXTENSIONS));
-#ifdef GL_VERSION_2_0
{
const GLubyte *v = glGetString(GL_VERSION);
if (v[0] * 10 + v[2] >= 20) {
@@ -33,7 +32,6 @@ int main( int argc, char *argv[] )
printf("GL_SHADING_LANGUAGE_VERSION = %s\n", slv);
}
}
-#endif
printf("GLU_VERSION: %s\n", (char *) gluGetString(GLU_VERSION));
printf("GLU_EXTENSIONS: %s\n", (char *) gluGetString(GLU_EXTENSIONS));
diff --git a/src/demos/spriteblast.c b/src/demos/spriteblast.c
index 9aeae506..9ce4966d 100644
--- a/src/demos/spriteblast.c
+++ b/src/demos/spriteblast.c
@@ -442,12 +442,8 @@ key(unsigned char c, int x, int y)
case 'o':
case 'O':
org ^= 1;
-#ifdef GL_VERSION_2_0
-#ifdef GL_ARB_point_parameters
glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN,
org ? GL_LOWER_LEFT : GL_UPPER_LEFT);
-#endif
-#endif
glutPostRedisplay();
break;
case 't':
@@ -656,9 +652,7 @@ main(int argc, char **argv)
glEnable(GL_POINT_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPointSize(32.0);
-#ifdef GL_ARB_point_parameters
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
-#endif
glutMainLoop();
return 0; /* ANSI C requires main to return int. */