OpenSceneGraph/include
Robert Osfield 353b18b27b From Aurelien Albert, Added support for glPrimitiveRestartIndex.
"The idea of this new OpenGL feature is :

- set RestartIndex = "n"
- draw elements strip
  -> when the index is "n", the strip is "stopped" and restarted

It's very usefull for drawing tiles with a single strip and a "restart" at the end of each row.

The idea a an OSG StateAttribute is :

Usually we use to build geometry from code, because software modelers rarely support it (and 3d file formats doesn't support it) :

-RootNode <= "PrimitiveRestartIndex=0"     // So now, we know that our restart index is 0 for all drawables under this node
|
- Drawable 1 : triangles => as usual
|
- Drawable 2 : triangles strip => as usual
|
- Drawable 3 : triangles strip + "GL_PRIMITIVE_RESTART" mode = ON => use the restart index
|
- Drawable 4 : triangles strip + "GL_PRIMITIVE_RESTART" mode = ON => use the restart index
|
- Drawable 5 : triangles strip => as usual


With a StateAttribute, it's easy for the developper to say "0 will be my restart index for all this object" and then activate the mode only on some nodes.

The main problem is if you set and restart index value which is not included in the vertex array (for exemple set restart index = 100 but you have only 50 vertex). There is no problem with OpenGL, but some OSG algorithms will try to access the vertex[100] and will segfault.

To solve this, I think there is two ways :

1/ add restart index in osg::PrimitiveSet and use this value in all algorithms. It's a lot of work, maybe dangerous, and it concern only a few situations : developpers who use this extension should be aware of advanced OpenGL (and OSG) data management

2/ use a StateAttribute, and choose a "correct" restart index. In my applications, I always use "0" as a restart index and duplicate the first vertex (vertex[0] = vertex[1]). So there is no difference for OpenGL and all OSG algorithms works properly.
"
2013-06-28 13:43:46 +00:00
..
OpenThreads From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
osg From Aurelien Albert, Added support for glPrimitiveRestartIndex. 2013-06-28 13:43:46 +00:00
osgAnimation From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
osgDB From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
osgFX Ran script to remove trailing spaces and tabs 2012-03-21 17:36:20 +00:00
osgGA From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
osgManipulator From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
osgParticle From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
osgPresentation Added <display_broadcast_event> and <dismiss_broadcast_event> support to <timeout> to allow the different timeout statges to be broadcast. 2013-01-17 13:51:52 +00:00
osgQt From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
osgShadow Fixed date typo 2013-05-28 14:40:36 +00:00
osgSim From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
osgTerrain From Ulrich Hertlein, "Attached is a patch that introduces 'static_cast<unsigned int>' on some instances where 2013-05-14 16:12:21 +00:00
osgText From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
osgUtil From Lars Nillson, "The change in this submission is to take care of the setting given by a call to 2013-06-24 11:14:13 +00:00
osgViewer From David Callu, "in osgViewer::WoWVxDisplay::WoWVxDisplay(unsigned int type=20, unsigned int screenNum=0) 2013-06-28 10:59:01 +00:00
osgVolume From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
osgWidget Changed point to osg::ref_ptr<> to prevent memory leaks. 2013-04-16 09:26:40 +00:00