Hi Aurelien,
On 10 June 2013 19:43, Aurelien Albert <[email protected]> wrote:
> About GL_PATCH_DEFAULT_INNER_LEVEL and GL_PATCH_DEFAULT_OUTER_LEVEL : I also
> think that a dedicated StateAttribute is the best way to implement this and
> let users do what they want with it.
I think a osg::Patch/PatchSize StateAttribute is probably the best way forward.
> Maybe a default value ("1.0" is probably the best one) should be set at top
> of the scene graph (just like some other StateAttribute) ?
Default constructed state attribute would best reflect normal OpenGL
defaults, you won't even need to define it at the top of the scene
graph as the osg::State already automatically clones a default
constructed state attribute the first time it comes comes across a new
type of state attribute.
> About the enum problem : I understand that a direct mapping between OSG and
> OpenGL enums is very convenient. But perhaps we can use here some kind of
> "magic value" :
>
>
> {
> POINTS = GL_POINTS
> LINES = GL_LINES
> LINE_STRIP = GL_LINE_STRIP
> LINE_LOOP = GL_LINE_LOOP
> TRIANGLES = GL_TRIANGLES
> TRIANGLE_STRIP = GL_TRIANGLE_STRIP
> TRIANGLE_FAN = GL_TRIANGLE_FAN
> QUADS = GL_QUADS
> QUAD_STRIP = GL_QUAD_STRIP
> POLYGON = GL_POLYGON
> LINES_ADJACENCY = GL_LINES_ADJACENCY
> LINE_STRIP_ADJACENCY = GL_LINE_STRIP_ADJACENCY
> TRIANGLES_ADJACENCY = GL_TRIANGLES_ADJACENCY
> TRIANGLE_STRIP_ADJACENCY = GL_TRIANGLE_STRIP_ADJACENCY
> PATCHES_0 = SOME_KIND_OF_MAGIC_VALUE
> PATCHES_1 = PATCHES_0 + 1
> PATCHES_2 = PATCHES_0 + 2
> PATCHES_3 = PATCHES_0 + 3
> ...
> PATCHES_N = PATCHES_0 + N
> };
>
> So in the code, the test could be like :
>
>
> Code:
> if (mode >= PATCHES_0)
> {
> use "GL_PATCH" draw mode
> set "GL_PATCH_SIZE" = (mode-PATCHES_0)
> }
> else
> {
> use "mode" draw mode
> }
I think perhaps we are trying to be too clever here, mixing different
OpenGL features into a single property. Given Mode directly matches
to OpenGL enums I don't think it consistent to then have it map to our
own mapping as well, it should be either not mapped at all, or all
1:1.
My current preference is to have a something like
osg::Patch/PatchSize/TesselationPatch that wraps up the defaults all
the GL_PATCH_* properties in one StateAttribute and to pull the
GL_PATCH support from osg::StateAttribute.
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org