void PTexMesh::RenderWireframe()

in ReplicaSDK/ptex/PTexLib.cpp [176:225]


void PTexMesh::RenderWireframe(
        const pangolin::OpenGlRenderState& cam,
        const Eigen::Vector4f& clipPlane) {
  const bool doClip =
      !(clipPlane(0) == 0.f && clipPlane(1) == 0.f && clipPlane(2) == 0.f && clipPlane(3) == 0.f);

  GLdouble eqn[4] = {clipPlane(0), clipPlane(1), clipPlane(2), clipPlane(3)};

  if (doClip) {
    glClipPlane(GL_CLIP_PLANE0, eqn);
    glEnable(GL_CLIP_PLANE0);
  }

  cam.Apply();

  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

  glPushAttrib(GL_LINE_BIT);
  glLineWidth(1.5f);

  glColor4f(0.25f, 0.25f, 0.25f, 1.0f);

  glPushAttrib(GL_POLYGON_BIT);
  glFrontFace(GL_CCW);

  for (size_t i = 0; i < meshes.size(); i++) {
    meshes[i]->vbo.Bind();
    glVertexPointer(meshes[i]->vbo.count_per_element, meshes[i]->vbo.datatype, 0, 0);
    glEnableClientState(GL_VERTEX_ARRAY);

    meshes[i]->ibo.Bind();

    glDrawElements(GL_QUADS, meshes[i]->ibo.num_elements, meshes[i]->ibo.datatype, 0);

    meshes[i]->ibo.Unbind();

    glDisableClientState(GL_VERTEX_ARRAY);
    meshes[i]->vbo.Unbind();
  }

  glPopAttrib();

  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

  if (doClip) {
    glDisable(GL_CLIP_PLANE0);
  }

  glPopAttrib();
}