Hi Gabriel,

OSG is a fine layer over OpenGL, so the vertex order rule
is the same as OpenGL. You code seem good.

Error is probably in the rest of the code we don't have.

HTH
David

2013/3/27 Gabriel Francu <[email protected]>

> Hi,
>
> I try to build a very simple shape, represented in sketch.png.
>
>
> Code:
>
> osg::Vec3Array *points = new osg::Vec3Array();
> points->push_back( osg::Vec3( -0.5f, -0.5f, -0.5f ) );
> points->push_back( osg::Vec3( 0.5f, -0.5f, -0.5f ) );
> points->push_back( osg::Vec3( -0.5f, 0.5f, -0.5f ) );
> points->push_back( osg::Vec3( 0.5f, 0.5f, -0.5f ) );
> points->push_back( osg::Vec3( 0.5f, 0.5f, 0.5f ) );
> points->push_back( osg::Vec3( -0.5f, 0.5f, 0.5f ) );
>
> osg::DrawElementsUInt *faces = new osg::DrawElementsUInt(GL_TRIANGLES);
> faces->push_back(2); faces->push_back(0); faces->push_back(1);
> faces->push_back(2); faces->push_back(1); faces->push_back(3);
>
>
>
> Then three versions
> left
>
> Code:
>
> faces->push_back(2); faces->push_back(3); faces->push_back(4);
> faces->push_back(2); faces->push_back(4); faces->push_back(5);
>
>
>
> center
>
> Code:
>
> faces->push_back(3); faces->push_back(4); faces->push_back(2);
> faces->push_back(4); faces->push_back(5); faces->push_back(2);
>
>
>
> right
>
> Code:
>
> faces->push_back(4); faces->push_back(2); faces->push_back(3);
> faces->push_back(5); faces->push_back(2); faces->push_back(4);
>
>
>
>
> The order of vertices in center and right version is only rotated from the
> left version.
> Then I add the normals, with BIND_PER_VERTEX. I use a flat render mode.
>
> Why only the left version gives the correct result? Is there a rule for
> the vertex ordering?
>
> Thank you!
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=53340#53340
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/result_209.png
> http://forum.openscenegraph.org//files/sketch_204.png
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to