build fixes :

- remove ptexViewer from the build on OSX (doesnt work)
- remove maya plugins from the build on OSX (until we have a compatible version available)

glViewer fixes :
- fix incorrect GLFW version check in #ifdefs (now done in cmake)
- fix default program GL version (downgraded to 1.5 where necessary)
- remove non core-profile GL calls (triggering errors)

this should allow OSX 10.7 builds to produce a functional, if restricted, glViewer.

fixes #111
This commit is contained in:
Manuel Kraemer 2013-02-04 18:37:25 -08:00
parent 626b8c40bf
commit 2b12ffc447
2 changed files with 15 additions and 10 deletions

View File

@ -59,7 +59,8 @@ if( OPENGL_FOUND AND (GLEW_FOUND AND GLFW_FOUND) OR (APPLE AND GLFW_FOUND))
add_subdirectory(glViewer)
# add_subdirectory(simpleCpu)
# add_subdirectory(evalTest)
if(PTEX_FOUND)
if(PTEX_FOUND AND (NOT APPLE))
# the ptexViewer example requires GL functionality not available on OSX
add_subdirectory(ptexViewer)
endif()
else()
@ -90,7 +91,8 @@ if(DXSDK_FOUND)
add_subdirectory(dxViewer)
endif()
if(MAYA_FOUND)
# XXXX manuelk : turning off the maya plugin examples for now
if(MAYA_FOUND AND (NOT APPLE))
add_subdirectory(mayaViewer)
if(PTEX_FOUND)
add_subdirectory(mayaPtexViewer)

View File

@ -189,7 +189,7 @@ int g_frame = 0,
int g_fullscreen = 0,
g_freeze = 0,
g_wire = 2,
g_adaptive = 1,
g_adaptive = 0,
g_drawCageEdges = 1,
g_drawCageVertices = 0,
g_drawPatchCVs = 0,
@ -284,15 +284,21 @@ compileShader(GLenum shaderType, const char *source)
GLuint shader = glCreateShader(shaderType);
glShaderSource(shader, 1, &source, NULL);
glCompileShader(shader);
checkGLErrors("compileShader");
return shader;
}
static bool
linkDefaultProgram()
{
#if defined(GL_ARB_tessellation_shader) || defined(GL_VERSION_4_0)
#define GLSL_VERSION_DEFINE "#version 400\n"
#else
#define GLSL_VERSION_DEFINE "#version 150\n"
#endif
static const char *vsSrc =
"#version 410\n"
GLSL_VERSION_DEFINE
"in vec3 position;\n"
"in vec3 color;\n"
"out vec4 fragColor;\n"
@ -304,7 +310,7 @@ linkDefaultProgram()
"}\n";
static const char *fsSrc =
"#version 410\n"
GLSL_VERSION_DEFINE
"in vec4 fragColor;\n"
"out vec4 color;\n"
"void main() {\n"
@ -314,6 +320,7 @@ linkDefaultProgram()
GLuint program = glCreateProgram();
GLuint vertexShader = compileShader(GL_VERTEX_SHADER, vsSrc);
GLuint fragmentShader = compileShader(GL_FRAGMENT_SHADER, fsSrc);
glAttachShader(program, vertexShader);
glAttachShader(program, fragmentShader);
@ -807,9 +814,7 @@ drawCageEdges() {
glVertexAttribPointer(g_defaultProgram.attrColor,
3, GL_FLOAT, GL_FALSE, sizeof (GLfloat) * 6, (void*)12);
glLineWidth(2.0f);
glDrawArrays(GL_LINES, 0, (int)g_coarseEdges.size());
glLineWidth(1.0f);
glBindVertexArray(0);
glUseProgram(0);
@ -1714,7 +1719,6 @@ setGLCoreProfile()
#define GLFW_OPENGL_VERSION_MINOR GLFW_CONTEXT_VERSION_MINOR
#endif
#if GLFW_VERSION_MAJOR>=2 and GLFW_VERSION_MINOR >=7
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
#if not defined(__APPLE__)
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 4);
@ -1724,7 +1728,6 @@ setGLCoreProfile()
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
#endif
#endif
}