mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-29 14:51:05 +00:00
Fixed a few OS X build errors.
This commit is contained in:
parent
9e371e4e89
commit
93476a368d
@ -1016,7 +1016,7 @@ EffectDrawRegistry::_CreateDrawConfig(
|
|||||||
g_levelBaseMap[config->program] = glGetUniformLocation(config->program, "LevelBase");
|
g_levelBaseMap[config->program] = glGetUniformLocation(config->program, "LevelBase");
|
||||||
|
|
||||||
GLint loc;
|
GLint loc;
|
||||||
#if not defined(GL_ARB_separate_shader_objects) || defined(GL_VERSION_4_1)
|
#if not (defined(GL_ARB_separate_shader_objects) || defined(GL_VERSION_4_1))
|
||||||
glUseProgram(config->program);
|
glUseProgram(config->program);
|
||||||
if ((loc = glGetUniformLocation(config->program, "g_VertexBuffer")) != -1) {
|
if ((loc = glGetUniformLocation(config->program, "g_VertexBuffer")) != -1) {
|
||||||
glUniform1i(loc, 0); // GL_TEXTURE0
|
glUniform1i(loc, 0); // GL_TEXTURE0
|
||||||
@ -1087,6 +1087,7 @@ bindProgram(Effect effect, OpenSubdiv::OsdPatchArray const & patch)
|
|||||||
|
|
||||||
void applyPatchColor(GLuint program, int patchType, int patchPattern)
|
void applyPatchColor(GLuint program, int patchType, int patchPattern)
|
||||||
{
|
{
|
||||||
|
#if (defined(GL_ARB_separate_shader_objects) || defined(GL_VERSION_4_1))
|
||||||
GLuint diffuseColor = glGetUniformLocation(program, "diffuseColor");
|
GLuint diffuseColor = glGetUniformLocation(program, "diffuseColor");
|
||||||
if (g_displayPatchColor) {
|
if (g_displayPatchColor) {
|
||||||
switch(patchType) {
|
switch(patchType) {
|
||||||
@ -1138,6 +1139,7 @@ void applyPatchColor(GLuint program, int patchType, int patchPattern)
|
|||||||
} else {
|
} else {
|
||||||
glProgramUniform4f(program, diffuseColor, 0.4f, 0.4f, 0.8f, 1);
|
glProgramUniform4f(program, diffuseColor, 0.4f, 0.4f, 0.8f, 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void
|
static void
|
||||||
@ -1283,8 +1285,10 @@ display() {
|
|||||||
for (int i=0; i<(int)patches.size(); ++i) {
|
for (int i=0; i<(int)patches.size(); ++i) {
|
||||||
OpenSubdiv::OsdPatchArray const & patch = patches[i];
|
OpenSubdiv::OsdPatchArray const & patch = patches[i];
|
||||||
|
|
||||||
|
#if defined(GL_ARB_tessellation_shader) || defined(GL_VERSION_4_0)
|
||||||
OpenSubdiv::OsdPatchType patchType = patch.desc.type;
|
OpenSubdiv::OsdPatchType patchType = patch.desc.type;
|
||||||
int patchPattern = patch.desc.pattern;
|
int patchPattern = patch.desc.pattern;
|
||||||
|
#endif
|
||||||
|
|
||||||
GLenum primType;
|
GLenum primType;
|
||||||
if (g_mesh->GetDrawContext()->IsAdaptive()) {
|
if (g_mesh->GetDrawContext()->IsAdaptive()) {
|
||||||
@ -1300,11 +1304,9 @@ display() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GL_ARB_tessellation_shader) || defined(GL_VERSION_4_0)
|
|
||||||
GLuint program = bindProgram(GetEffect(), patch);
|
GLuint program = bindProgram(GetEffect(), patch);
|
||||||
|
#if defined(GL_ARB_tessellation_shader) || defined(GL_VERSION_4_0)
|
||||||
applyPatchColor(program, patchType, patchPattern);
|
applyPatchColor(program, patchType, patchPattern);
|
||||||
#else
|
|
||||||
bindProgram(GetEffect(), patch);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_wire == 0) {
|
if (g_wire == 0) {
|
||||||
@ -1313,8 +1315,8 @@ display() {
|
|||||||
GLuint uniformGregoryQuadOffset = g_gregoryQuadOffsetBaseMap[program];
|
GLuint uniformGregoryQuadOffset = g_gregoryQuadOffsetBaseMap[program];
|
||||||
GLuint uniformLevelBase = g_levelBaseMap[program];
|
GLuint uniformLevelBase = g_levelBaseMap[program];
|
||||||
if (g_drawAtOnce or (not g_adaptive)) {
|
if (g_drawAtOnce or (not g_adaptive)) {
|
||||||
glProgramUniform1i(program, uniformGregoryQuadOffset, patch.gregoryQuadOffsetBase);
|
glUniform1i(uniformGregoryQuadOffset, patch.gregoryQuadOffsetBase);
|
||||||
glProgramUniform1i(program, uniformLevelBase, patch.levelBase);
|
glUniform1i(uniformLevelBase, patch.levelBase);
|
||||||
|
|
||||||
glDrawElements(primType,
|
glDrawElements(primType,
|
||||||
patch.numIndices, GL_UNSIGNED_INT,
|
patch.numIndices, GL_UNSIGNED_INT,
|
||||||
@ -1326,9 +1328,9 @@ display() {
|
|||||||
|
|
||||||
int primitiveOffset = (drawRanges[j].firstIndex - patch.firstIndex)/patch.desc.GetPatchSize();
|
int primitiveOffset = (drawRanges[j].firstIndex - patch.firstIndex)/patch.desc.GetPatchSize();
|
||||||
if (patch.desc.type == OpenSubdiv::kGregory || patch.desc.type == OpenSubdiv::kBoundaryGregory){
|
if (patch.desc.type == OpenSubdiv::kGregory || patch.desc.type == OpenSubdiv::kBoundaryGregory){
|
||||||
glProgramUniform1i(program, uniformGregoryQuadOffset, patch.gregoryQuadOffsetBase + primitiveOffset*4);
|
glUniform1i(uniformGregoryQuadOffset, patch.gregoryQuadOffsetBase + primitiveOffset*4);
|
||||||
}
|
}
|
||||||
glProgramUniform1i(program, uniformLevelBase, patch.levelBase + primitiveOffset);
|
glUniform1i(uniformLevelBase, patch.levelBase + primitiveOffset);
|
||||||
|
|
||||||
glDrawElements(primType, drawRanges[j].numIndices, GL_UNSIGNED_INT,
|
glDrawElements(primType, drawRanges[j].numIndices, GL_UNSIGNED_INT,
|
||||||
(void *)(drawRanges[j].firstIndex * sizeof(unsigned int)));
|
(void *)(drawRanges[j].firstIndex * sizeof(unsigned int)));
|
||||||
|
@ -430,7 +430,9 @@ updateGeom() {
|
|||||||
color[1] = 0.0f;
|
color[1] = 0.0f;
|
||||||
color[2] = g_coords[i].v;
|
color[2] = g_coords[i].v;
|
||||||
|
|
||||||
#pragma omp atomic
|
#ifdef OPENSUBDIV_HAS_OPENMP
|
||||||
|
#pragma omp atomic
|
||||||
|
#endif
|
||||||
g_nsamplesFound += n;
|
g_nsamplesFound += n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -746,8 +746,6 @@ main(int argc, char ** argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char windowTitle[] = "OpenSubdiv glViewer";
|
|
||||||
|
|
||||||
int width=10, height=10;
|
int width=10, height=10;
|
||||||
|
|
||||||
#if GLFW_VERSION_MAJOR>=3
|
#if GLFW_VERSION_MAJOR>=3
|
||||||
|
Loading…
Reference in New Issue
Block a user