summaryrefslogtreecommitdiff
path: root/src/demos/dinoshade.c
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 /src/demos/dinoshade.c
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>
Diffstat (limited to 'src/demos/dinoshade.c')
-rw-r--r--src/demos/dinoshade.c70
1 files changed, 28 insertions, 42 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");