From 1d9e7f144b22ec1be2febc7280d2d56f9229f8a4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 2 Mar 2015 12:09:25 +0000 Subject: [PATCH] From Michael McDonnel, "The tessellation shader example has a small bug.The middle of the geometry is clipped as soon as it is tessellated. The clipping is probably caused by rounding errors because it is only in one spot. The clipping disappears when the camera is moved, and reappears when it is moved back. Expanding the the bounding box fixed the clipping bug." Tweaked by Robert Osfield to expand it to a -1 to 1 unit box. Actual clipping bug is not due to rounding errors but the shaders creating vertices outside the bounding box of the original input vertices git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14747 16af8721-9629-0410-8352-f15c8da7e697 --- examples/osgtessellationshaders/osgtessellationshaders.cpp | 4 ++++ include/osg/GLDefines | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/osgtessellationshaders/osgtessellationshaders.cpp b/examples/osgtessellationshaders/osgtessellationshaders.cpp index ab1e6d1d3..04235700c 100644 --- a/examples/osgtessellationshaders/osgtessellationshaders.cpp +++ b/examples/osgtessellationshaders/osgtessellationshaders.cpp @@ -171,6 +171,10 @@ osg::ref_ptr CreateIcosahedron(osg::Program *program) geometry->setVertexArray(vertices); geometry->addPrimitiveSet(new osg::DrawElementsUInt(osg::PrimitiveSet::PATCHES,IndexCount,Faces)); + // Expand the bounding box, otherwise the geometry is clipped in front when tessellating. + osg::BoundingBox bbox(osg::Vec3(-1.0f, -1.9f, -1.0f), osg::Vec3(1.0f, 1.0f, 1.0f)); + geometry->setInitialBound(bbox); + geode->addDrawable(geometry); return geode; } diff --git a/include/osg/GLDefines b/include/osg/GLDefines index 393c666cc..094211129 100644 --- a/include/osg/GLDefines +++ b/include/osg/GLDefines @@ -177,7 +177,7 @@ typedef char GLchar; #define GL_FRAMEBUFFER_SRGB 0x8DB9 #endif -#ifndef EXT_geometry_shader4 +#ifndef GL_EXT_geometry_shader4 #define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA #define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB #define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC