Demos (cmake): Portability fixes.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Sat Nov 6 06:12:20 PDT 2010


Module: Demos
Branch: cmake
Commit: 00a6f9c531eb245ae07715aa1f75cfee03ef21d8
URL:    http://cgit.freedesktop.org/mesa/demos/commit/?id=00a6f9c531eb245ae07715aa1f75cfee03ef21d8

Author: José Fonseca <jfonseca at vmware.com>
Date:   Sat Nov  6 13:10:54 2010 +0000

Portability fixes.

These are necessary because we're not longer building against the
Mesa GL headers here, but the system headers, which on windows
miss several of the extensions.

Simply including glew.h addresses most cases.

---

 src/redbook/cubemap.c        |    1 +
 src/redbook/multisamp.c      |    1 +
 src/samples/nurb.c           |   12 +++---------
 src/samples/quad.c           |   12 +++---------
 src/tests/texdown.c          |    1 +
 src/tests/texleak.c          |    2 ++
 src/trivial/line-smooth.c    |    1 +
 src/trivial/point-sprite.c   |    1 +
 src/trivial/quad-tex-2d.c    |    1 +
 src/trivial/quad-tex-alpha.c |    1 +
 src/trivial/tri-alpha-tex.c  |    1 +
 src/trivial/tri-tex-1d.c     |    1 +
 src/trivial/tri-tex.c        |    1 +
 13 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/redbook/cubemap.c b/src/redbook/cubemap.c
index 92026c7..e82cec6 100644
--- a/src/redbook/cubemap.c
+++ b/src/redbook/cubemap.c
@@ -50,6 +50,7 @@
  *  forward and backward.
  */
 
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/src/redbook/multisamp.c b/src/redbook/multisamp.c
index 38bd572..4826227 100644
--- a/src/redbook/multisamp.c
+++ b/src/redbook/multisamp.c
@@ -53,6 +53,7 @@
  *  background.  Antialiasing is sometimes easier to see
  *  when objects are rendered over a contrasting background.
  */
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/src/samples/nurb.c b/src/samples/nurb.c
index dc89912..099144e 100644
--- a/src/samples/nurb.c
+++ b/src/samples/nurb.c
@@ -26,14 +26,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
-#ifndef CALLBACK
-#define CALLBACK
-#endif
-
-
 #define INREAL float
 
 #define S_NUMPOINTS 13
@@ -207,7 +203,7 @@ Point ctlpoints[S_NUMPOINTS][T_NUMPOINTS] = {
 GLUnurbsObj *theNurbs;
 
 
-static void CALLBACK ErrorCallback(GLenum which)
+static void GLAPIENTRY ErrorCallback(GLenum which)
 {
 
     if (which != expectedError) {
@@ -216,13 +212,11 @@ static void CALLBACK ErrorCallback(GLenum which)
     }
 }
 
-typedef void (GLAPIENTRY *callback_t)();
-
 static void Init(void)
 {
 
     theNurbs = gluNewNurbsRenderer();
-    gluNurbsCallback(theNurbs, GLU_ERROR, (callback_t) ErrorCallback);
+    gluNurbsCallback(theNurbs, GLU_ERROR, (_GLUfuncptr) ErrorCallback);
 
     gluNurbsProperty(theNurbs, GLU_SAMPLING_TOLERANCE, 15.0);
     gluNurbsProperty(theNurbs, GLU_DISPLAY_MODE, GLU_OUTLINE_PATCH);
diff --git a/src/samples/quad.c b/src/samples/quad.c
index 193850a..8171d76 100644
--- a/src/samples/quad.c
+++ b/src/samples/quad.c
@@ -25,14 +25,10 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
-#ifndef CALLBACK
-#define CALLBACK
-#endif
-
-
 #define PI 3.141592654
 #define	BLACK 0
 #define	GRAY 128
@@ -96,14 +92,12 @@ GLubyte brickImage[4*brickImageWidth*brickImageHeight] = {
 char *texFileName = 0;
 
 
-static void CALLBACK ErrorHandler(GLenum which)
+static void GLAPIENTRY ErrorHandler(GLenum which)
 {
 
     fprintf(stderr, "Quad Error: %s\n", (char *) gluErrorString(which));
 }
 
-typedef void (GLAPIENTRY *callback_t)();
-
 static void Init(void)
 {
     static GLint colorIndexes[3] = {0, 200, 255};
@@ -165,7 +159,7 @@ static void Init(void)
     }
 
     quadObj = gluNewQuadric();
-    gluQuadricCallback(quadObj, GLU_ERROR, (callback_t) ErrorHandler);
+    gluQuadricCallback(quadObj, GLU_ERROR, (_GLUfuncptr) ErrorHandler);
 
     radius1 = 10;
     radius2 = 5;
diff --git a/src/tests/texdown.c b/src/tests/texdown.c
index 92df01b..7d7af1a 100644
--- a/src/tests/texdown.c
+++ b/src/tests/texdown.c
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
diff --git a/src/tests/texleak.c b/src/tests/texleak.c
index 5cf4ff3..e9dcb58 100644
--- a/src/tests/texleak.c
+++ b/src/tests/texleak.c
@@ -84,7 +84,9 @@ static void Display( void )
 	  end.tv_sec * 1000 + end.tv_usec / 1000 - start.tv_sec * 1000 -
 	  start.tv_usec / 1000, numTexObj * 4 * size / 1024 * size / 1024);
 
+#ifndef _WIN32
    sleep(1);
+#endif
 }
 
 
diff --git a/src/trivial/line-smooth.c b/src/trivial/line-smooth.c
index 9c4b9a0..78eac6f 100644
--- a/src/trivial/line-smooth.c
+++ b/src/trivial/line-smooth.c
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
diff --git a/src/trivial/point-sprite.c b/src/trivial/point-sprite.c
index 16e6771..e6c7ee2 100644
--- a/src/trivial/point-sprite.c
+++ b/src/trivial/point-sprite.c
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
diff --git a/src/trivial/quad-tex-2d.c b/src/trivial/quad-tex-2d.c
index 8a886ef..54a1a31 100644
--- a/src/trivial/quad-tex-2d.c
+++ b/src/trivial/quad-tex-2d.c
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static GLenum Target = GL_TEXTURE_2D;
diff --git a/src/trivial/quad-tex-alpha.c b/src/trivial/quad-tex-alpha.c
index 9db6792..a8d01df 100644
--- a/src/trivial/quad-tex-alpha.c
+++ b/src/trivial/quad-tex-alpha.c
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
diff --git a/src/trivial/tri-alpha-tex.c b/src/trivial/tri-alpha-tex.c
index 853d564..64030e8 100644
--- a/src/trivial/tri-alpha-tex.c
+++ b/src/trivial/tri-alpha-tex.c
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
diff --git a/src/trivial/tri-tex-1d.c b/src/trivial/tri-tex-1d.c
index 5a8a23c..881ddbe 100644
--- a/src/trivial/tri-tex-1d.c
+++ b/src/trivial/tri-tex-1d.c
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 static GLenum Target = GL_TEXTURE_1D;
diff --git a/src/trivial/tri-tex.c b/src/trivial/tri-tex.c
index 244e154..3063907 100644
--- a/src/trivial/tri-tex.c
+++ b/src/trivial/tri-tex.c
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 



More information about the mesa-commit mailing list