[Piglit] [PATCH 08/15] glean: call glewInit()

Paul Berry stereotype441 at gmail.com
Fri Mar 2 15:40:26 PST 2012


Previously glean didn't initialize GLEW, presumably because glean only
uses GL 1.0 functions, and those functions bypass GLEW.  But once we
switch to using piglit-dispatch instead of GLEW, we will need to
initialize it in order for any GL functions to work.  This patch adds
a call to glewInit() in the place where a call to
piglit_dispatch_default_init() will eventually be needed.
---
 tests/glean/CMakeLists.gl.txt |    2 ++
 tests/glean/tbase.h           |    6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt
index 04081a9..0221a25 100644
--- a/tests/glean/CMakeLists.gl.txt
+++ b/tests/glean/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ include_directories(
 	${GLEXT_INCLUDE_DIR}
 	${OPENGL_INCLUDE_PATH}
 	${TIFF_INCLUDE_DIR}
+	${piglit_SOURCE_DIR}/tests/util
 )
 
 add_executable (glean
@@ -88,6 +89,7 @@ add_executable (glean
 )
 
 target_link_libraries (glean
+	piglitutil
 	${OPENGL_gl_LIBRARY}
 	${OPENGL_glu_LIBRARY}
 	${GLUT_glut_LIBRARY}
diff --git a/tests/glean/tbase.h b/tests/glean/tbase.h
index 16fe251..748ee62 100644
--- a/tests/glean/tbase.h
+++ b/tests/glean/tbase.h
@@ -106,6 +106,8 @@ and tbasic.cpp.
 #ifndef __tbase_h__
 #define __tbase_h__
 
+#include "glew.h"
+
 #ifdef __UNIX__
 #include <unistd.h>
 #endif
@@ -309,6 +311,10 @@ public:
 					// XXX need to throw exception here
 				}
 
+				// Make sure glew is initialized so we can call
+				// GL functions safely.
+				glewInit();
+
 				// Check if test is applicable to this context
 				if (!isApplicable())
 					continue;
-- 
1.7.7.6



More information about the Piglit mailing list