in ReplicaSDK/ptex/PTexLib.cpp [128:161]
void PTexMesh::RenderSubMeshDepth(
size_t subMesh,
const pangolin::OpenGlRenderState& cam,
const float depthScale,
const Eigen::Vector4f& clipPlane) {
ASSERT(subMesh < meshes.size());
Mesh& mesh = *meshes[subMesh];
glPushAttrib(GL_POLYGON_BIT);
int currFrontFace;
glGetIntegerv(GL_FRONT_FACE, &currFrontFace);
//Drawing the faces has the opposite winding order to the GL_LINES_ADJACENCY
glFrontFace(currFrontFace == GL_CW ? GL_CCW : GL_CW);
depthShader.Bind();
depthShader.SetUniform("MVP", cam.GetProjectionModelViewMatrix());
depthShader.SetUniform("MV", cam.GetModelViewMatrix());
depthShader.SetUniform("clipPlane", clipPlane(0), clipPlane(1), clipPlane(2), clipPlane(3));
depthShader.SetUniform("scale", depthScale);
mesh.vbo.Bind();
glVertexAttribPointer(0, mesh.vbo.count_per_element, mesh.vbo.datatype, GL_FALSE, 0, 0);
glEnableVertexAttribArray(0);
mesh.vbo.Unbind();
mesh.ibo.Bind();
glDrawElements(GL_QUADS, mesh.ibo.num_elements, mesh.ibo.datatype, 0);
mesh.ibo.Unbind();
glDisableVertexAttribArray(0);
depthShader.Unbind();
glPopAttrib();
}