Continued cleanup of OpenGL dependencies

This commit is contained in:
David G Yu 2013-06-26 00:52:57 -07:00
parent dc81d98246
commit 7d16bffccb
18 changed files with 76 additions and 115 deletions

View File

@ -296,6 +296,11 @@ if(GLFW_FOUND AND (GLFW_VERSION VERSION_EQUAL 3.0 OR GLFW_VERSION VERSION_GREATE
add_definitions( -DGLFW_VERSION_3 )
endif()
# note: perhaps rename this to be more consistent, e.g. OPENSUBDIV_USES_GLEW
if(GLEW_FOUND)
add_definitions( -DOSD_USES_GLEW )
endif()
# note : (GLSL transform feedback kernels require GL 4.2)
if(GLEW_FOUND AND OPENGL_4_2_FOUND)
add_definitions(

View File

@ -60,7 +60,7 @@ if( OPENGL_FOUND AND (GLEW_FOUND AND GLFW_FOUND) OR (APPLE AND GLFW_FOUND))
add_subdirectory(glBatchViewer)
add_subdirectory(simpleCpu)
add_subdirectory(limitEval)
if(OPENGL_4_3_FOUND)
if(OPENGL_4_3_FOUND AND (NOT APPLE))
# the paintTest example requires GL functionality not available on OSX
add_subdirectory(paintTest)
endif()

View File

@ -55,27 +55,13 @@
// a particular purpose and non-infringement.
//
#if defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
#include <OpenGLES/ES2/gl.h>
#else
#include <OpenGL/gl3.h>
#endif
#elif defined(ANDROID)
#include <GLES2/gl2.h>
#else
#if defined(_WIN32)
#include <windows.h>
#endif
#include <GL/glew.h>
#endif
#include "gl_hud.h"
#include "font_image.h"
#include "simple_math.h"
#include <string.h>
#include <stdio.h>
#include "gl_hud.h"
#include "font_image.h"
#include "simple_math.h"
static const char *s_VS =
#if defined(GL_VERSION_3_1)

View File

@ -57,24 +57,10 @@
#ifndef GL_HUD_H
#define GL_HUD_H
#if defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
#include <OpenGLES/ES2/gl.h>
#else
#include <OpenGL/gl3.h>
#endif
#elif defined(ANDROID)
#include <GLES2/gl2.h>
#else
#if defined(_WIN32)
#include <windows.h>
#endif
#include <GL/gl.h>
#endif
#include "hud.h"
#include <osd/opengl.h>
class GLhud : public Hud
{
public:

View File

@ -54,24 +54,11 @@
// exclude the implied warranties of merchantability, fitness for
// a particular purpose and non-infringement.
//
#if defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
#include <OpenGLES/ES2/gl.h>
#else
#include <OpenGL/gl3.h>
#endif
#elif defined(ANDROID)
#include <GLES2/gl2.h>
#else
#if defined(_WIN32)
#include <windows.h>
#endif
#include <GL/glew.h>
#endif
#include "delegate.h"
#include <osd/opengl.h>
MyDrawContext::MyDrawContext() {
glGenVertexArrays(1, &_vao);
}

View File

@ -54,26 +54,14 @@
// exclude the implied warranties of merchantability, fitness for
// a particular purpose and non-infringement.
//
#if defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
#include <OpenGLES/ES2/gl.h>
#else
#include <OpenGL/gl3.h>
#endif
#elif defined(ANDROID)
#include <GLES2/gl2.h>
#else
#if defined(_WIN32)
#include <windows.h>
#endif
#include <GL/glew.h>
#endif
#include "effect.h"
#include "../common/simple_math.h"
#include "../common/patchColors.h"
#include <osd/opengl.h>
#include <stdio.h>
#include <string.h>

View File

@ -57,24 +57,10 @@
#ifndef EFFECT_H
#define EFFECT_H
#if defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
#include <OpenGLES/ES2/gl.h>
#else
#include <OpenGL/gl3.h>
#endif
#elif defined(ANDROID)
#include <GLES2/gl2.h>
#else
#if defined(_WIN32)
#include <windows.h>
#endif
#include <GL/gl.h>
#endif
#include <osd/glDrawRegistry.h>
#include <osd/opengl.h>
union EffectDesc {
public:
struct {

View File

@ -54,24 +54,11 @@
// exclude the implied warranties of merchantability, fitness for
// a particular purpose and non-infringement.
//
#if defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
#include <OpenGLES/ES2/gl.h>
#else
#include <OpenGL/gl3.h>
#endif
#elif defined(ANDROID)
#include <GLES2/gl2.h>
#else
#if defined(_WIN32)
#include <windows.h>
#endif
#include <GL/glew.h>
#endif
#include "effectRegistry.h"
#include <osd/opengl.h>
static const char *shaderSource =
#if defined(GL_ARB_tessellation_shader) || defined(GL_VERSION_4_0)
#include "shader.inc"

View File

@ -56,7 +56,11 @@
//
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#if defined(OSD_USES_GLEW)
#include <GL/glew.h>
#else
#include <OpenGL/gl3.h>
#endif
#define GLFW_INCLUDE_GL3
#define GLFW_NO_GLU
#else
@ -993,7 +997,7 @@ int main(int argc, char ** argv)
glfwSetWindowSizeCallback(reshape);
#endif
#if not defined(__APPLE__)
#if defined(OSD_USES_GLEW)
#ifdef CORE_PROFILE
// this is the only way to initialize glew correctly under core profile context.
glewExperimental = true;

View File

@ -56,7 +56,11 @@
//
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#if defined(OSD_USES_GLEW)
#include <GL/glew.h>
#else
#include <OpenGL/gl3.h>
#endif
#define GLFW_INCLUDE_GL3
#define GLFW_NO_GLU
#else
@ -1825,7 +1829,7 @@ int main(int argc, char ** argv)
#endif
#if not defined(__APPLE__)
#if defined(OSD_USES_GLEW)
#ifdef CORE_PROFILE
// this is the only way to initialize glew correctly under core profile context.
glewExperimental = true;

View File

@ -56,7 +56,11 @@
//
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#if defined(OSD_USES_GLEW)
#include <GL/glew.h>
#else
#include <OpenGL/gl3.h>
#endif
#define GLFW_INCLUDE_GL3
#define GLFW_NO_GLU
#else
@ -1223,7 +1227,7 @@ int main(int argc, char **argv) {
glfwSetWindowCloseCallback(windowClose);
#endif
#if not defined(__APPLE__)
#if defined(OSD_USES_GLEW)
#ifdef CORE_PROFILE
// this is the only way to initialize glew correctly under core profile context.
glewExperimental = true;

View File

@ -56,7 +56,11 @@
//
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#if defined(OSD_USES_GLEW)
#include <GL/glew.h>
#else
#include <OpenGL/gl3.h>
#endif
#define GLFW_INCLUDE_GL3
#define GLFW_NO_GLU
#else
@ -1369,7 +1373,7 @@ int main(int argc, char ** argv)
#endif
#if not defined(__APPLE__)
#if defined(OSD_USES_GLEW)
#ifdef CORE_PROFILE
// this is the only way to initialize glew correctly under core profile context.
glewExperimental = true;

View File

@ -56,7 +56,11 @@
//
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#if defined(OSD_USES_GLEW)
#include <GL/glew.h>
#else
#include <OpenGL/gl3.h>
#endif
#define GLFW_INCLUDE_GL3
#define GLFW_NO_GLU
#else
@ -2077,7 +2081,7 @@ int main(int argc, char ** argv) {
glfwSetMouseButtonCallback(mouse);
#endif
#if not defined(__APPLE__)
#if defined(OSD_USES_GLEW)
#ifdef CORE_PROFILE
// this is the only way to initialize glew correctly under core profile context.
glewExperimental = true;

View File

@ -16,7 +16,11 @@
// The following is to ensure the example runs on Linux, Windows and OS X
//
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#if defined(OSD_USES_GLEW)
#include <GL/glew.h>
#else
#include <OpenGL/gl3.h>
#endif
#define GLFW_INCLUDE_GL3
#define GLFW_NO_GLU
#include <stdio.h>

View File

@ -1,18 +1,23 @@
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#if defined(OSD_USES_GLEW)
#include <GL/glew.h>
#else
#include <OpenGL/gl3.h>
#endif
#define GLFW_INCLUDE_GL3
#define GLFW_NO_GLU
#include <stdio.h>
#else
#include <stdlib.h>
#include <stdio.h>
#include <GL/glew.h>
#if defined(WIN32)
#include <GL/wglew.h>
#endif
#endif
#include <stdio.h>
#include <stdlib.h>
#if defined(GLFW_VERSION_3)
#include <GLFW/glfw3.h>
GLFWwindow* g_window=0;
@ -128,7 +133,7 @@ int main(int argc, char ** argv)
#if not defined(__APPLE__)
#if defined(OSD_USES_GLEW)
#ifdef CORE_PROFILE
// this is the only way to initialize glew correctly under core profile context.
glewExperimental = true;

View File

@ -63,7 +63,6 @@ include_directories(
)
if( OPENGL_FOUND )
add_definitions( -DOSD_USES_GLEW )
include_directories(
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}

View File

@ -62,7 +62,11 @@
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
#include <OpenGLES/ES2/gl.h>
#else
#include <OpenGL/gl3.h>
#if defined(OSD_USES_GLEW)
#include <GL/glew.h>
#else
#include <OpenGL/gl3.h>
#endif
#endif
#elif defined(ANDROID)
#include <GLES2/gl2.h>

View File

@ -56,7 +56,11 @@
//
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#if defined(OSD_USES_GLEW)
#include <GL/glew.h>
#else
#include <OpenGL/gl3.h>
#endif
#define GLFW_INCLUDE_GL3
#define GLFW_NO_GLU
#else
@ -762,7 +766,7 @@ main(int argc, char ** argv) {
}
#endif
#if not defined(__APPLE__)
#if defined(OSD_USES_GLEW)
if (GLenum r = glewInit() != GLEW_OK) {
printf("Failed to initialize glew. error = %d\n", r);
exit(1);