[Piglit] [PATCHv2 07/10] piglit: add defines to gl_wrap.h to improve portability

Chia-I Wu olvaffe at gmail.com
Sun Sep 4 19:44:58 PDT 2011


Define GL_TEXTURE_CUBE_MAP_* to GL_TEXTURE_CUBE_MAP_*_OES for GLES1.
This should help us port piglit-util.c or some of the cubemap tests to
GLES1 without or with less #ifdef ugliness.

Also make sure we cannot include more than one set of headers from GL,
GLES1, and GLES2 headers.
---
 src/piglit/gl_wrap.h |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/piglit/gl_wrap.h b/src/piglit/gl_wrap.h
index dc0afe8..8fddd2f 100644
--- a/src/piglit/gl_wrap.h
+++ b/src/piglit/gl_wrap.h
@@ -42,7 +42,7 @@ extern "C" {
 #include <windows.h>
 #endif
 
-#ifdef USE_OPENGL
+#if defined(USE_OPENGL)
 #	include "glew.h"
 	/* Include the real headers too, in case GLEW misses something. */
 #	ifdef __APPLE__
@@ -54,14 +54,20 @@ extern "C" {
 #		include <GL/glu.h>
 #		include <GL/glext.h>
 #	endif
-#endif
 
-#ifdef USE_OPENGL_ES1
+#elif defined(USE_OPENGL_ES1)
 #	include <GLES/gl.h>
 #	include <GLES/glext.h>
-#endif
 
-#ifdef USE_OPENGL_ES2
+	/* for source level compatibility */
+#       define GL_TEXTURE_CUBE_MAP_POSITIVE_X GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES
+#       define GL_TEXTURE_CUBE_MAP_POSITIVE_Y GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES
+#       define GL_TEXTURE_CUBE_MAP_POSITIVE_Z GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES
+#       define GL_TEXTURE_CUBE_MAP_NEGATIVE_X GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES
+#       define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES
+#       define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES
+
+#elif defined(USE_OPENGL_ES2)
 #	include <GLES2/gl2.h>
 #	include <GLES2/gl2ext.h>
 #endif
-- 
1.7.5.4



More information about the Piglit mailing list