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
This commit is contained in:
Robert Osfield
2015-03-02 12:09:25 +00:00
parent 0a83632f0a
commit 1d9e7f144b
2 changed files with 5 additions and 1 deletions

View File

@@ -171,6 +171,10 @@ osg::ref_ptr<osg::Geode> 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;
}

View File

@@ -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