Commit d75d8a18 authored by fogal1's avatar fogal1

Use GLEW initializer.

A couple plots were manually initializing GLEW.  This makes them
use the new avtGLEWInitializer, meaning 1) if both plots are used
in a session, GLEW shouldn't get initialized twice, and 2) they
can work against Mesa, and thus in SR mode.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@8022 18c085ea-50e0-402c-830e-de6fd14e8384
parent c13d4f8e
...@@ -50,9 +50,7 @@ ...@@ -50,9 +50,7 @@
#ifndef VTK_IMPLEMENT_MESA_CXX #ifndef VTK_IMPLEMENT_MESA_CXX
#include <visit-config.h> #include <visit-config.h>
#ifdef HAVE_LIBGLEW #include <avtGLEWInitializer.h>
#include <GL/glew.h>
#endif
#if defined(__APPLE__) && (defined(VTK_USE_CARBON) || defined(VTK_USE_COCOA)) #if defined(__APPLE__) && (defined(VTK_USE_CARBON) || defined(VTK_USE_COCOA))
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#else #else
...@@ -664,6 +662,9 @@ ShaderModeData::SetHint(int hint, int val) ...@@ -664,6 +662,9 @@ ShaderModeData::SetHint(int hint, int val)
// Brad Whitlock, Fri Sep 15 13:32:08 PST 2006 // Brad Whitlock, Fri Sep 15 13:32:08 PST 2006
// Made sure that GLEW can initialize okay. // Made sure that GLEW can initialize okay.
// //
// Tom Fogal, Sat Jul 25 19:46:22 MDT 2009
// Use new glew initialization wrapper.
//
// **************************************************************************** // ****************************************************************************
bool bool
...@@ -671,14 +672,7 @@ ShaderModeData::ModeAvailable() ...@@ -671,14 +672,7 @@ ShaderModeData::ModeAvailable()
{ {
if(!GLSL_init) if(!GLSL_init)
{ {
GLenum err = glewInit(); GLSL_init = avt::glew::initialize();
if(err != GLEW_OK)
{
debug1 << "ShaderModeData::ModeAvailable: glewInit() failed: "
<< glewGetErrorString(err) << endl;
return false;
}
GLSL_init = true;
} }
return GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader; return GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader;
} }
......
...@@ -62,10 +62,7 @@ ...@@ -62,10 +62,7 @@
#ifndef VTK_IMPLEMENT_MESA_CXX #ifndef VTK_IMPLEMENT_MESA_CXX
// Include GLEW. // Include GLEW.
#include <visit-config.h> #include <visit-config.h>
#ifdef HAVE_LIBGLEW #include <avtGLEWInitializer.h>
#include <GL/glew.h>
static bool glew_initialized = false;
#endif
#if defined(__APPLE__) && (defined(VTK_USE_CARBON) || defined(VTK_USE_COCOA)) #if defined(__APPLE__) && (defined(VTK_USE_CARBON) || defined(VTK_USE_COCOA))
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
...@@ -106,6 +103,9 @@ ...@@ -106,6 +103,9 @@
// I removed the code to get the glTexImage3D extension and initialized // I removed the code to get the glTexImage3D extension and initialized
// the GLEW library. // the GLEW library.
// //
// Tom Fogal, Sat Jul 25 19:45:26 MDT 2009
// Use new GLEW initialization wrapper.
//
// **************************************************************************** // ****************************************************************************
avtOpenGL3DTextureVolumeRenderer::avtOpenGL3DTextureVolumeRenderer() avtOpenGL3DTextureVolumeRenderer::avtOpenGL3DTextureVolumeRenderer()
...@@ -114,16 +114,7 @@ avtOpenGL3DTextureVolumeRenderer::avtOpenGL3DTextureVolumeRenderer() ...@@ -114,16 +114,7 @@ avtOpenGL3DTextureVolumeRenderer::avtOpenGL3DTextureVolumeRenderer()
volumetexId = 0; volumetexId = 0;
#ifndef VTK_IMPLEMENT_MESA_CXX #ifndef VTK_IMPLEMENT_MESA_CXX
#ifdef HAVE_LIBGLEW avt::glew::initialize();
GLenum err = glewInit();
if(err != GLEW_OK)
{
debug1 << "avtOpenGL3DTextureVolumeRenderer ctor: "
<< glewGetErrorString(err) << endl;
}
else
glew_initialized = true;
#endif
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment