Commit 9b05421c authored by Marcel Campen's avatar Marcel Campen
Browse files

mesh offset rendering option fixed



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@19740 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 22ad2ebf
......@@ -88,7 +88,8 @@ MeshNodeT(Mesh& _mesh,
anyPickingBaseIndex_(0),
perFaceTextureIndexAvailable_(false),
perFaceTextureCoordsAvailable_(false),
textureMap_(0)
textureMap_(0),
draw_with_offset_(false)
{
/// \todo : Handle vbo not supported
......@@ -214,15 +215,18 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
drawMesh_->usePerVertexColors();
*/
GLenum prev_depth = _state.depthFunc();
glPushAttrib(GL_ENABLE_BIT);
GLenum prev_depth_offset = _state.depthFunc();
if(draw_with_offset_)
{
ACG::GLState::enable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(0.001f, 0.0f);
glPolygonOffset(-1.0f, -10.0f);
ACG::GLState::depthFunc(GL_LEQUAL);
}
GLenum prev_depth = _state.depthFunc();
/// get bound texture buffer and target
GLuint lastBuffer = ACG::GLState::getBoundTextureBuffer();
......@@ -600,6 +604,11 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
// Unbind all remaining buffers
ACG::GLState::bindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB , 0 );
if(draw_with_offset_)
{
ACG::GLState::depthFunc(prev_depth_offset);
}
glPopAttrib();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment