Hi guys,

I want to develop OSG examples in iOS but OpenGL provides only a sub-set of 
OSG. Is this the reason why for example this code doesnt work on the simulator? 
:

osgViewer::Viewer viewer;

    osg::Group* root = new osg::Group();
    osg::Geode* pyramidGeode = new osg::Geode();
    osg::Geometry* pyramidGeometry = new osg::Geometry();
    
    pyramidGeode->addDrawable(pyramidGeometry); 
    root->addChild(pyramidGeode);
    
    osg::Vec3Array* pyramidVertices = new osg::Vec3Array;
    pyramidVertices->push_back( osg::Vec3( 0, 0, 0) ); // front left
    pyramidVertices->push_back( osg::Vec3(10, 0, 0) ); // front right
    pyramidVertices->push_back( osg::Vec3(10,10, 0) ); // back right 
    pyramidVertices->push_back( osg::Vec3( 0,10, 0) ); // back left 
    pyramidVertices->push_back( osg::Vec3( 5, 5,10) ); // peak
    
    pyramidGeometry->setVertexArray( pyramidVertices ); 

    osg::DrawElementsUInt* pyramidFaceOne = new 
osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, 0);
    pyramidFaceOne->push_back(0);
    pyramidFaceOne->push_back(1);
    pyramidFaceOne->push_back(4);
    pyramidGeometry->addPrimitiveSet(pyramidFaceOne);
    
    osg::Vec4Array* colors = new osg::Vec4Array;
    colors->push_back(osg::Vec4(1.0f, 0.0f, 0.0f, 1.0f) ); //index 0 red
    colors->push_back(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f) ); //index 1 green
    colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f) ); //index 2 blue
    colors->push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f) ); //index 3 white 
    colors->push_back(osg::Vec4(1.0f, 0.0f, 0.0f, 1.0f) ); //index 4 red
    
    pyramidGeometry->setColorArray(colors);
    pyramidGeometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
    
    viewer.setSceneData( root );
    //viewer.run();
    viewer.setCameraManipulator(new osgGA::TrackballManipulator());
    viewer.realize();
    
    while(true) {
        viewer.frame();
    }


I get the output: 
Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..)



Thank you!

Cheers,
Tobias

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=42532#42532





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to