Merge pull request #809 from thomthom/dev-iso646-fix-gl

iso-646 fix for GLEW and GLFW projects
This commit is contained in:
David G Yu 2016-06-25 13:54:22 -07:00 committed by GitHub
commit d34f167ee5
15 changed files with 114 additions and 114 deletions

View File

@ -65,7 +65,7 @@ For more details about OpenSubdiv, see [Pixar Graphics Technologies](http://grap
${GLEW_LOCATION}/lib/libGLEW.a (linux)
${GLEW_LOCATION}/lib/glew32.lib (windows)
${GLFW_LOCATION}/include/glfw3.h
${GLFW_LOCATION}/include/GLFW/glfw3.h
${GLFW_LOCATION}/lib/libglfw3.a (linux)
${GLFW_LOCATION}/lib/glfw3.lib (windows)
```

View File

@ -246,7 +246,7 @@ GLhud::Rebuild(int width, int height,
int framebufferWidth, int framebufferHeight) {
Hud::Rebuild(width, height, framebufferWidth, framebufferHeight);
if (not _staticVbo)
if (! _staticVbo)
return;
_staticVboSize = (int)getStaticVboSource().size();

View File

@ -238,7 +238,7 @@ static void
createEdgeNumbers(OpenSubdiv::Far::TopologyRefiner const & refiner,
std::vector<Vertex> const & vertexBuffer, bool ids=false, bool sharpness=false) {
if (ids or sharpness) {
if (ids || sharpness) {
int maxlevel = refiner.GetMaxLevel(),
firstvert = 0;
@ -345,7 +345,7 @@ static void
createPatchNumbers(OpenSubdiv::Far::PatchTable const & patchTable,
std::vector<Vertex> const & vertexBuffer) {
if (not g_currentPatch)
if (! g_currentPatch)
return;
int patchID = g_currentPatch-1,
@ -388,7 +388,7 @@ createFVarPatchNumbers(OpenSubdiv::Far::PatchTable const & patchTable,
int patch = g_currentPatch-1;
static char buf[16];
if (patch>=0 and patch<patchTable.GetNumPatchesTotal()) {
if (patch>=0 && patch<patchTable.GetNumPatchesTotal()) {
OpenSubdiv::Far::PatchTable::PatchHandle handle;
handle.patchIndex = patch;
@ -613,7 +613,7 @@ createFarGLMesh(Shape * shape, int maxlevel) {
//
std::vector<Vertex> fvarBuffer;
Far::PatchTable * patchTable = 0;
bool createFVarWire = g_FarDrawFVarPatches or g_FarDrawFVarVerts;
bool createFVarWire = g_FarDrawFVarPatches || g_FarDrawFVarVerts;
if (g_Adaptive) {
Far::PatchTableFactory::Options options;
@ -685,7 +685,7 @@ createFarGLMesh(Shape * shape, int maxlevel) {
stencilTable = Far::StencilTableFactory::Create(*refiner, options);
// append local point stencils if needed
if (patchTable and patchTable->GetLocalPointStencilTable()) {
if (patchTable && patchTable->GetLocalPointStencilTable()) {
if (Far::StencilTable const * stencilTableWithLocalPoints =
Far::StencilTableFactory::AppendLocalPointStencilTable(
*refiner, stencilTable,
@ -734,7 +734,7 @@ createFarGLMesh(Shape * shape, int maxlevel) {
createFaceNumbers(*refiner, vertexBuffer);
}
if (g_FarDrawPtexIDs and patchTable) {
if (g_FarDrawPtexIDs && patchTable) {
createPtexNumbers(*patchTable, vertexBuffer);
}
@ -742,11 +742,11 @@ createFarGLMesh(Shape * shape, int maxlevel) {
createPatchNumbers(*patchTable, vertexBuffer);
}
if (g_Adaptive and g_FarDrawGregogyBasis) {
if (g_Adaptive && g_FarDrawGregogyBasis) {
createGregoryBasis(*patchTable, vertexBuffer);
}
if (g_Adaptive and createFVarWire) {
if (g_Adaptive && createFVarWire) {
createFVarPatches(*refiner, *patchTable, fvarBuffer);
createFVarPatchNumbers(*patchTable, fvarBuffer);
}
@ -774,7 +774,7 @@ createFarGLMesh(Shape * shape, int maxlevel) {
g_controlMeshDisplay.SetTopology(refiner->GetLevel(0));
// save coarse points in a GPU buffer (used for control mesh display)
if (not g_controlMeshDisplayVBO) {
if (! g_controlMeshDisplayVBO) {
glGenBuffers(1, &g_controlMeshDisplayVBO);
}
glBindBuffer(GL_ARRAY_BUFFER, g_controlMeshDisplayVBO);
@ -807,7 +807,7 @@ createFarGLMesh(Shape * shape, int maxlevel) {
static void
createMeshes(ShapeDesc const & desc, int maxlevel) {
if (not g_font) {
if (! g_font) {
g_font = new GLFont(g_hud.GetFontTexture());
}
g_font->Clear();
@ -923,15 +923,15 @@ display() {
}
g_far_glmesh.Draw(comp, g_transformUB, g_lightingUB);
if (g_Adaptive and g_FarDrawGregogyBasis) {
if (g_Adaptive && g_FarDrawGregogyBasis) {
gregoryWire.Draw(GLMesh::COMP_VERT, g_transformUB, g_lightingUB);
gregoryWire.Draw(GLMesh::COMP_EDGE, g_transformUB, g_lightingUB);
}
if (g_Adaptive and g_FarDrawFVarVerts) {
if (g_Adaptive && g_FarDrawFVarVerts) {
fvarVerts.Draw(GLMesh::COMP_VERT, g_transformUB, g_lightingUB);
}
if (g_Adaptive and g_FarDrawFVarPatches) {
if (g_Adaptive && g_FarDrawFVarPatches) {
fvarWire.Draw(GLMesh::COMP_EDGE, g_transformUB, g_lightingUB);
}
@ -966,9 +966,9 @@ display() {
* format0 = "Current Patch : %d/%d (%s - %d CVs)",
* format1 = "Current Patch : %d/%d (%s - %d CVs) fvar: (%s - %d CVs)";
if (g_Adaptive and g_currentPatch) {
if (g_Adaptive && g_currentPatch) {
if (g_FarDrawFVarPatches or g_FarDrawFVarVerts) {
if (g_FarDrawFVarPatches || g_FarDrawFVarVerts) {
g_hud.DrawString(g_width/2-200, 225, format1,
g_currentPatch-1, g_numPatches-1,
@ -1020,7 +1020,7 @@ motion(GLFWwindow *, double dx, double dy) {
// pan
g_pan[0] -= g_dolly*(x - g_prev_x)/g_width;
g_pan[1] += g_dolly*(y - g_prev_y)/g_height;
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) or
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) ||
(!g_mbutton[0] && g_mbutton[1] && !g_mbutton[2])) {
// dolly
g_dolly -= g_dolly*0.01f*(x - g_prev_x);
@ -1291,7 +1291,7 @@ initHUD() {
g_hud.AddPullDownButton(fvar_pulldown, "FVAR_LINEAR_ALL",
SdcOptions::FVAR_LINEAR_ALL, g_fvarInterpolation==SdcOptions::FVAR_LINEAR_ALL);
if (not g_font) {
if (! g_font) {
g_font = new GLFont( g_hud.GetFontTexture() );
}
}
@ -1320,7 +1320,7 @@ uninitGL() {
static void
idle() {
if (g_repeatCount != 0 and g_frame >= g_repeatCount)
if (g_repeatCount != 0 && g_frame >= g_repeatCount)
g_running = 0;
}
@ -1349,7 +1349,7 @@ int main(int argc, char ** argv)
}
initShapes();
if (not glfwInit()) {
if (! glfwInit()) {
printf("Failed to initialize GLFW\n");
return 1;
}
@ -1364,7 +1364,7 @@ int main(int argc, char ** argv)
// apparently glfwGetPrimaryMonitor fails under linux : if no primary,
// settle for the first one in the list
if (not g_primary) {
if (! g_primary) {
int count=0;
GLFWmonitor ** monitors = glfwGetMonitors(&count);
@ -1379,8 +1379,8 @@ int main(int argc, char ** argv)
}
}
if (not (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen and g_primary ? g_primary : NULL, NULL))) {
if (! (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen && g_primary ? g_primary : NULL, NULL))) {
printf("Failed to open window.\n");
glfwTerminate();
return 1;

View File

@ -65,7 +65,7 @@ void GLFont::bindProgram() {
#include "fontShader.gen.h"
;
// Update and bind transform state
if (not _program) {
if (! _program) {
_program = glCreateProgram();
@ -106,15 +106,15 @@ void GLFont::bindProgram() {
}
glUseProgram(_program);
if (not _scale) {
if (! _scale) {
_scale = glGetUniformLocation(_program, "scale");
}
if (not _attrPosition) {
if (! _attrPosition) {
_attrPosition = glGetAttribLocation(_program, "position");
}
if (not _attrData) {
if (! _attrData) {
_attrData = glGetAttribLocation(_program, "data");
}
}
@ -169,7 +169,7 @@ void GLFont::Draw(GLuint transformUB) {
bindProgram();
if (not _transformBinding) {
if (! _transformBinding) {
GLuint uboIndex = glGetUniformBlockIndex(_program, "Transform");
if (uboIndex != GL_INVALID_INDEX)

View File

@ -87,7 +87,7 @@ getFaceTexture() {
#include "face_texture.h"
if (not g_faceTexture) {
if (! g_faceTexture) {
glGenTextures(1, &g_faceTexture);
glBindTexture(GL_TEXTURE_2D, g_faceTexture);
@ -742,13 +742,13 @@ GLMesh::InitializeDeviceBuffers() {
// copy buffers to device
for (int i=0; i<COMP_NUM_COMPONENTS; ++i) {
if (not _VAO[i]) {
if (! _VAO[i]) {
glGenVertexArrays(1, &_VAO[i]);
}
glBindVertexArray(_VAO[i]);
if (not _vbo[i].empty()) {
if (not _VBO[i]) {
if (! _vbo[i].empty()) {
if (! _VBO[i]) {
glGenBuffers(1, &_VBO[i]);
}
glBindBuffer(GL_ARRAY_BUFFER, _VBO[i]);
@ -768,9 +768,9 @@ GLMesh::InitializeDeviceBuffers() {
}
}
if (not _eao[i].empty()) {
if (! _eao[i].empty()) {
if (not _EAO[i]) {
if (! _EAO[i]) {
glGenBuffers(1, &_EAO[i]);
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _EAO[i]);
@ -780,7 +780,7 @@ GLMesh::InitializeDeviceBuffers() {
GLUtils::CheckGLErrors("init");
}
if (not _faceColors.empty()) {
if (! _faceColors.empty()) {
_TBOfaceColors = createTextureBuffer(_faceColors, GL_RGBA32F);
}
@ -829,7 +829,7 @@ bindProgram( char const * shaderSource,
lightingBinding=1;
// Update and bind transform state
if (not *program) {
if (! *program) {
*program = glCreateProgram();

View File

@ -354,12 +354,12 @@ public:
}
virtual void UpdatePatchCoords(
std::vector<Osd::PatchCoord> const &patchCoords) {
if (_patchCoords and
if (_patchCoords &&
_patchCoords->GetNumVertices() != (int)patchCoords.size()) {
delete _patchCoords;
_patchCoords = NULL;
}
if (not _patchCoords) {
if (! _patchCoords) {
_patchCoords = EVAL_VERTEX_BUFFER::Create(5,
(int)patchCoords.size(),
_deviceContext);
@ -901,12 +901,12 @@ display() {
static void
idle() {
if (not g_freeze)
if (! g_freeze)
g_frame++;
updateGeom();
if (g_repeatCount != 0 and g_frame >= g_repeatCount)
if (g_repeatCount != 0 && g_frame >= g_repeatCount)
g_running = 0;
}
@ -924,7 +924,7 @@ motion(GLFWwindow *, double dx, double dy) {
// pan
g_pan[0] -= g_dolly*(x - g_prev_x)/g_width;
g_pan[1] += g_dolly*(y - g_prev_y)/g_height;
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) or
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) ||
(!g_mbutton[0] && g_mbutton[1] && !g_mbutton[2])) {
// dolly
g_dolly -= g_dolly*0.01f*(x - g_prev_x);
@ -1233,7 +1233,7 @@ int main(int argc, char **argv) {
initShapes();
glfwSetErrorCallback(callbackErrorGLFW);
if (not glfwInit()) {
if (! glfwInit()) {
printf("Failed to initialize GLFW\n");
return 1;
}
@ -1248,7 +1248,7 @@ int main(int argc, char **argv) {
// apparently glfwGetPrimaryMonitor fails under linux : if no primary,
// settle for the first one in the list
if (not g_primary) {
if (! g_primary) {
int count=0;
GLFWmonitor ** monitors = glfwGetMonitors(&count);
@ -1263,8 +1263,8 @@ int main(int argc, char **argv) {
}
}
if (not (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen and g_primary ? g_primary : NULL, NULL))) {
if (! (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen && g_primary ? g_primary : NULL, NULL))) {
std::cerr << "Failed to create OpenGL context.\n";
glfwTerminate();
return 1;

View File

@ -361,7 +361,7 @@ rebuildMesh() {
g_scheme = scheme;
// Adaptive refinement currently supported only for catmull-clark scheme
bool doAdaptive = (g_adaptive!=0 and g_scheme==kCatmark);
bool doAdaptive = (g_adaptive!=0 && g_scheme==kCatmark);
OpenSubdiv::Osd::MeshBitset bits;
bits.set(OpenSubdiv::Osd::MeshAdaptive, doAdaptive);
@ -532,7 +532,7 @@ public:
// face varying width
ss << "#define OSD_FVAR_WIDTH 2\n";
if (not effectDesc.desc.IsAdaptive()) {
if (! effectDesc.desc.IsAdaptive()) {
ss << "#define SHADING_FACEVARYING_UNIFORM_SUBDIVISION\n";
}
@ -821,7 +821,7 @@ motion(GLFWwindow *, double dx, double dy) {
// pan
g_uvPan[0] -= (x - g_prev_x) * 2 / g_uvScale / static_cast<float>(g_width/2);
g_uvPan[1] += (y - g_prev_y) * 2 / g_uvScale / static_cast<float>(g_height);
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) or
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) ||
(!g_mbutton[0] && g_mbutton[1] && !g_mbutton[2])) {
// scale
g_uvScale += g_uvScale*0.01f*(x - g_prev_x);
@ -836,7 +836,7 @@ motion(GLFWwindow *, double dx, double dy) {
// pan
g_pan[0] -= g_dolly*(x - g_prev_x)/g_width;
g_pan[1] += g_dolly*(y - g_prev_y)/g_height;
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) or
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) ||
(!g_mbutton[0] && g_mbutton[1] && !g_mbutton[2])) {
// dolly
g_dolly -= g_dolly*0.01f*(x - g_prev_x);
@ -1046,12 +1046,12 @@ initGL() {
static void
idle() {
if (not g_freeze)
if (! g_freeze)
g_frame++;
updateGeom();
if (g_repeatCount != 0 and g_frame >= g_repeatCount)
if (g_repeatCount != 0 && g_frame >= g_repeatCount)
g_running = 0;
}
@ -1097,7 +1097,7 @@ int main(int argc, char ** argv) {
OpenSubdiv::Far::SetErrorCallback(callbackError);
glfwSetErrorCallback(callbackErrorGLFW);
if (not glfwInit()) {
if (! glfwInit()) {
printf("Failed to initialize GLFW\n");
return 1;
}
@ -1111,7 +1111,7 @@ int main(int argc, char ** argv) {
// apparently glfwGetPrimaryMonitor fails under linux : if no primary,
// settle for the first one in the list
if (not g_primary) {
if (! g_primary) {
int count = 0;
GLFWmonitor ** monitors = glfwGetMonitors(&count);
@ -1126,8 +1126,8 @@ int main(int argc, char ** argv) {
}
}
if (not (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen and g_primary ? g_primary : NULL, NULL))) {
if (! (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen && g_primary ? g_primary : NULL, NULL))) {
std::cerr << "Failed to create OpenGL context.\n";
glfwTerminate();
return 1;

View File

@ -521,7 +521,7 @@ int main(int argc, char ** argv) {
#endif
}
if (not glfwInit()) {
if (! glfwInit()) {
std::cout << "Failed to initialize GLFW\n";
return 1;
}
@ -532,7 +532,7 @@ int main(int argc, char ** argv) {
GLUtils::SetMinimumGLVersion();
GLFWwindow *window = glfwCreateWindow(width, height, windowTitle, NULL, NULL);
if (not window) {
if (! window) {
std::cerr << "Failed to create OpenGL context.\n";
glfwTerminate();
}

View File

@ -832,7 +832,7 @@ motion(GLFWwindow * w, double dx, double dy) {
// pan
g_pan[0] -= g_dolly*(x - g_prev_x)/g_width;
g_pan[1] += g_dolly*(y - g_prev_y)/g_height;
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) or
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) ||
(!g_mbutton[0] && g_mbutton[1] && !g_mbutton[2])) {
// dolly
g_dolly -= g_dolly*0.01f*(x - g_prev_x);
@ -860,7 +860,7 @@ mouse(GLFWwindow * w, int button, int state, int /* mods */) {
g_mbutton[button] = (state == GLFW_PRESS);
}
if (not glfwGetKey(w, GLFW_KEY_LEFT_ALT)) {
if (! glfwGetKey(w, GLFW_KEY_LEFT_ALT)) {
if (g_mbutton[0] && !g_mbutton[1] && !g_mbutton[2]) {
drawStroke(g_prev_x, g_prev_y);
}
@ -1100,7 +1100,7 @@ int main(int argc, char ** argv) {
OpenSubdiv::Far::SetErrorCallback(callbackError);
glfwSetErrorCallback(callbackErrorGLFW);
if (not glfwInit()) {
if (! glfwInit()) {
printf("Failed to initialize GLFW\n");
return 1;
}
@ -1115,7 +1115,7 @@ int main(int argc, char ** argv) {
// apparently glfwGetPrimaryMonitor fails under linux : if no primary,
// settle for the first one in the list
if (not g_primary) {
if (! g_primary) {
int count=0;
GLFWmonitor ** monitors = glfwGetMonitors(&count);
@ -1130,8 +1130,8 @@ int main(int argc, char ** argv) {
}
}
if (not (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen and g_primary ? g_primary : NULL, NULL))) {
if (! (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen && g_primary ? g_primary : NULL, NULL))) {
printf("Failed to open window.\n");
glfwTerminate();
return 1;

View File

@ -786,7 +786,7 @@ motion(GLFWwindow *, double dx, double dy) {
// pan
g_pan[0] -= g_dolly*(x - g_prev_x)/g_width;
g_pan[1] += g_dolly*(y - g_prev_y)/g_height;
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) or
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) ||
(!g_mbutton[0] && g_mbutton[1] && !g_mbutton[2])) {
// dolly
g_dolly -= g_dolly*0.01f*(x - g_prev_x);
@ -928,7 +928,7 @@ rebuildTopology() {
g_defaultShapes[i].scheme,
g_defaultShapes[i].isLeftHanded);
bool varying = (g_displayStyle==kVarying or g_displayStyle==kVaryingInterleaved);
bool varying = (g_displayStyle==kVarying || g_displayStyle==kVaryingInterleaved);
g_scene->AddTopology(shape, g_level, varying);
delete shape;
@ -1143,7 +1143,7 @@ initGL() {
//------------------------------------------------------------------------------
static void
idle() {
if (not g_freeze) {
if (! g_freeze) {
++g_frame;
updateGeom();
refine();
@ -1175,7 +1175,7 @@ int main(int argc, char ** argv) {
Far::SetErrorCallback(callbackError);
glfwSetErrorCallback(callbackErrorGLFW);
if (not glfwInit()) {
if (! glfwInit()) {
printf("Failed to initialize GLFW\n");
return 1;
}
@ -1184,7 +1184,7 @@ int main(int argc, char ** argv) {
GLUtils::SetMinimumGLVersion();
if (not (g_window=glfwCreateWindow(g_width, g_height, windowTitle, NULL, NULL))) {
if (! (g_window=glfwCreateWindow(g_width, g_height, windowTitle, NULL, NULL))) {
std::cerr << "Failed to create OpenGL context.\n";
glfwTerminate();
return 1;

View File

@ -480,8 +480,8 @@ public:
void Use( ) {
if (not _program) {
assert( _vtxSrc and _frgSrc );
if (! _program) {
assert( _vtxSrc && _frgSrc );
_program = glCreateProgram();
@ -749,12 +749,12 @@ display() {
static void
idle() {
if (not g_freeze)
if (! g_freeze)
g_frame++;
updateGeom();
if (g_repeatCount != 0 and g_frame >= g_repeatCount)
if (g_repeatCount != 0 && g_frame >= g_repeatCount)
g_running = 0;
}
@ -771,7 +771,7 @@ motion(GLFWwindow *, double dx, double dy) {
// pan
g_pan[0] -= g_dolly*(x - g_prev_x)/g_width;
g_pan[1] += g_dolly*(y - g_prev_y)/g_height;
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) or
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) ||
(!g_mbutton[0] && g_mbutton[1] && !g_mbutton[2])) {
// dolly
g_dolly -= g_dolly*0.01f*(x - g_prev_x);
@ -1037,7 +1037,7 @@ int main(int argc, char **argv) {
initShapes();
glfwSetErrorCallback(callbackErrorGLFW);
if (not glfwInit()) {
if (! glfwInit()) {
printf("Failed to initialize GLFW\n");
return 1;
}
@ -1052,7 +1052,7 @@ int main(int argc, char **argv) {
// apparently glfwGetPrimaryMonitor fails under linux : if no primary,
// settle for the first one in the list
if (not g_primary) {
if (! g_primary) {
int count=0;
GLFWmonitor ** monitors = glfwGetMonitors(&count);
@ -1067,8 +1067,8 @@ int main(int argc, char **argv) {
}
}
if (not (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen and g_primary ? g_primary : NULL, NULL))) {
if (! (g_window=glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen && g_primary ? g_primary : NULL, NULL))) {
std::cerr << "Failed to create OpenGL context.\n";
glfwTerminate();
return 1;

View File

@ -90,7 +90,7 @@ OpenSubdiv::Osd::GLLegacyGregoryPatchTable *g_legacyGregoryPatchTable = NULL;
source is returned. If glew in not available during compile time the version
is determined*/
static const char *shaderSource(){
#if not defined(OSD_USES_GLEW)
#if ! defined(OSD_USES_GLEW)
static const char *res =
#if defined(GL_ARB_tessellation_shader) || defined(GL_VERSION_4_0)
@ -299,7 +299,7 @@ updateGeom() {
int nverts = 0;
int stride = (g_shadingMode == kShadingInterleavedVaryingColor ? 7 : 3);
if (g_objAnim and g_currentShape==0) {
if (g_objAnim && g_currentShape==0) {
nverts = g_objAnim->GetShape()->GetNumVertices(),
@ -311,7 +311,7 @@ updateGeom() {
g_objAnim->InterpolatePositions(g_animTime, &vertex[0], stride);
if (g_shadingMode == kShadingVaryingColor or
if (g_shadingMode == kShadingVaryingColor ||
g_shadingMode == kShadingInterleavedVaryingColor) {
const float *p = &g_objAnim->GetShape()->verts[0];
@ -415,7 +415,7 @@ rebuildMesh() {
ShapeDesc const &shapeDesc = g_defaultShapes[g_currentShape];
int level = g_level;
int kernel = g_kernel;
bool doAnim = g_objAnim and g_currentShape==0;
bool doAnim = g_objAnim && g_currentShape==0;
Scheme scheme = shapeDesc.scheme;
Shape const * shape = 0;
@ -443,9 +443,9 @@ rebuildMesh() {
g_mesh = NULL;
// Adaptive refinement currently supported only for catmull-clark scheme
bool doAdaptive = (g_adaptive!=0 and scheme==kCatmark);
bool doAdaptive = (g_adaptive!=0 && scheme==kCatmark);
bool interleaveVarying = g_shadingMode == kShadingInterleavedVaryingColor;
bool doSingleCreasePatch = (g_singleCreasePatch!=0 and scheme==kCatmark);
bool doSingleCreasePatch = (g_singleCreasePatch!=0 && scheme==kCatmark);
Osd::MeshBitset bits;
bits.set(Osd::MeshAdaptive, doAdaptive);
@ -458,7 +458,7 @@ rebuildMesh() {
int numVertexElements = 3;
int numVaryingElements =
(g_shadingMode == kShadingVaryingColor or interleaveVarying) ? 4 : 0;
(g_shadingMode == kShadingVaryingColor || interleaveVarying) ? 4 : 0;
if (kernel == kCPU) {
@ -551,7 +551,7 @@ rebuildMesh() {
printf("Unsupported kernel %s\n", getKernelName(kernel));
}
if (g_shadingMode == kShadingFaceVaryingColor and shape->HasUV()) {
if (g_shadingMode == kShadingFaceVaryingColor && shape->HasUV()) {
std::vector<float> fvarData;
@ -570,7 +570,7 @@ rebuildMesh() {
Osd::GLLegacyGregoryPatchTable::Create(g_mesh->GetFarPatchTable());
}
if (not doAnim) {
if (! doAnim) {
delete shape;
}
@ -758,7 +758,7 @@ public:
case kShadingFaceVaryingColor:
ss << "#define OSD_FVAR_WIDTH 2\n";
ss << "#define SHADING_FACEVARYING_COLOR\n";
if (not effectDesc.desc.IsAdaptive()) {
if (! effectDesc.desc.IsAdaptive()) {
ss << "#define SHADING_FACEVARYING_UNIFORM_SUBDIVISION\n";
}
break;
@ -987,7 +987,7 @@ bindProgram(Effect effect,
// only legacy gregory needs maxValence and numElements
// neither legacy gregory nor gregory basis need single crease
typedef OpenSubdiv::Far::PatchDescriptor Descriptor;
if (patch.GetDescriptor().GetType() == Descriptor::GREGORY or
if (patch.GetDescriptor().GetType() == Descriptor::GREGORY ||
patch.GetDescriptor().GetType() == Descriptor::GREGORY_BOUNDARY) {
int maxValence = g_mesh->GetMaxValence();
int numElements = (g_shadingMode == kShadingInterleavedVaryingColor ? 7 : 3);
@ -1171,7 +1171,7 @@ display() {
g_fpsTimer.Stop();
float elapsed = (float)g_fpsTimer.GetElapsed();
if (not g_freeze) {
if (! g_freeze) {
g_animTime += elapsed;
}
g_fpsTimer.Start();
@ -1234,7 +1234,7 @@ motion(GLFWwindow *, double dx, double dy) {
// pan
g_pan[0] -= g_dolly*(x - g_prev_x)/g_width;
g_pan[1] += g_dolly*(y - g_prev_y)/g_height;
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) or
} else if ((g_mbutton[0] && !g_mbutton[1] && g_mbutton[2]) ||
(!g_mbutton[0] && g_mbutton[1] && !g_mbutton[2])) {
// dolly
g_dolly -= g_dolly*0.01f*(x - g_prev_x);
@ -1328,9 +1328,9 @@ callbackDisplayStyle(int b) {
static void
callbackShadingMode(int b) {
if (g_shadingMode == kShadingVaryingColor or b == kShadingVaryingColor or
g_shadingMode == kShadingInterleavedVaryingColor or b == kShadingInterleavedVaryingColor or
g_shadingMode == kShadingFaceVaryingColor or b == kShadingFaceVaryingColor) {
if (g_shadingMode == kShadingVaryingColor || b == kShadingVaryingColor ||
g_shadingMode == kShadingInterleavedVaryingColor || b == kShadingInterleavedVaryingColor ||
g_shadingMode == kShadingFaceVaryingColor || b == kShadingFaceVaryingColor) {
// need to rebuild for varying reconstruct
g_shadingMode = b;
rebuildMesh();
@ -1584,12 +1584,12 @@ initGL() {
static void
idle() {
if (not g_freeze) {
if (! g_freeze) {
g_frame++;
updateGeom();
}
if (g_repeatCount != 0 and g_frame >= g_repeatCount)
if (g_repeatCount != 0 && g_frame >= g_repeatCount)
g_running = 0;
}
@ -1641,7 +1641,7 @@ int main(int argc, char ** argv) {
}
}
if (not animobjs.empty()) {
if (! animobjs.empty()) {
g_defaultShapes.push_back(ShapeDesc(animobjs[0], "", kCatmark));
@ -1655,7 +1655,7 @@ int main(int argc, char ** argv) {
OpenSubdiv::Far::SetErrorCallback(callbackErrorOsd);
glfwSetErrorCallback(callbackErrorGLFW);
if (not glfwInit()) {
if (! glfwInit()) {
printf("Failed to initialize GLFW\n");
return 1;
}
@ -1670,7 +1670,7 @@ int main(int argc, char ** argv) {
// apparently glfwGetPrimaryMonitor fails under linux : if no primary,
// settle for the first one in the list
if (not g_primary) {
if (! g_primary) {
int count = 0;
GLFWmonitor ** monitors = glfwGetMonitors(&count);
@ -1686,9 +1686,9 @@ int main(int argc, char ** argv) {
}
g_window = glfwCreateWindow(g_width, g_height, windowTitle,
fullscreen and g_primary ? g_primary : NULL, NULL);
fullscreen && g_primary ? g_primary : NULL, NULL);
if (not g_window) {
if (! g_window) {
std::cerr << "Failed to create OpenGL context.\n";
glfwTerminate();
return 1;

View File

@ -88,12 +88,12 @@ CpuGLVertexBuffer::BindCpuBuffer() {
GLuint
CpuGLVertexBuffer::BindVBO(void * /*deviceContext*/) {
if (not _dataDirty)
if (! _dataDirty)
return _vbo;
int size = GetNumElements() * GetNumVertices() * sizeof(float);
if (not _vbo) {
if (! _vbo) {
glGenBuffers(1, &_vbo);
}

View File

@ -57,7 +57,7 @@ GLLegacyGregoryPatchTable::Create(Far::PatchTable const *farPatchTable) {
Far::PatchTable::QuadOffsetsTable const &
quadOffsetsTable = farPatchTable->GetQuadOffsetsTable();
if (not valenceTable.empty()) {
if (! valenceTable.empty()) {
GLuint buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
@ -71,7 +71,7 @@ GLLegacyGregoryPatchTable::Create(Far::PatchTable const *farPatchTable) {
glDeleteBuffers(1, &buffer);
}
if (not quadOffsetsTable.empty()) {
if (! quadOffsetsTable.empty()) {
GLuint buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);

View File

@ -188,7 +188,7 @@ checkVertexBuffer(
// boundary interpolation rules set to "none" produce "undefined"
// vertices on boundary vertices : far does not match hbr for those,
// so skip comparison.
if (hbrVertexOnBoundaryPtr and (*hbrVertexOnBoundaryPtr)[i])
if (hbrVertexOnBoundaryPtr && (*hbrVertexOnBoundaryPtr)[i])
continue;
const float *hbrPos = hbrVertexData[i].GetPos();
@ -586,25 +586,25 @@ static void
parseArgs(int argc, char ** argv) {
for (int argi=1; argi<argc; ++argi) {
if (not strcmp(argv[argi],"-compute")) {
if (! strcmp(argv[argi],"-compute")) {
const char * backend = NULL;
if (argi<(argc-1))
backend = argv[++argi];
if (not strcmp(backend, "all")) {
if (! strcmp(backend, "all")) {
g_Backend = -1;
} else {
bool found = false;
for (int i = 0; i < kBackendCount; ++i) {
if (not strcmp(backend, g_BackendNames[i])) {
if (! strcmp(backend, g_BackendNames[i])) {
g_Backend = i;
found = true;
break;
}
}
if (not found) {
if (! found) {
printf("-compute : must be 'all' or one of: ");
for (int i = 0; i < kBackendCount; ++i)
printf("%s ", g_BackendNames[i]);
@ -612,8 +612,8 @@ parseArgs(int argc, char ** argv) {
exit(0);
}
}
} else if ( (not strcmp(argv[argi],"-help")) or
(not strcmp(argv[argi],"-h")) ) {
} else if ( (! strcmp(argv[argi],"-help")) ||
(! strcmp(argv[argi],"-h")) ) {
usage(argv);
exit(1);
} else {
@ -633,7 +633,7 @@ main(int argc, char ** argv) {
parseArgs(argc, argv);
// Make sure we have an OpenGL context : create dummy GLFW window
if (not glfwInit()) {
if (! glfwInit()) {
printf("Failed to initialize GLFW\n");
return 1;
}
@ -641,7 +641,7 @@ main(int argc, char ** argv) {
int width=10, height=10;
static const char windowTitle[] = "OpenSubdiv OSD regression";
if (not (g_window=glfwCreateWindow(width, height, windowTitle, NULL, NULL))) {
if (! (g_window=glfwCreateWindow(width, height, windowTitle, NULL, NULL))) {
printf("Failed to open window.\n");
glfwTerminate();
return 1;