Hello,

Got another problem i guess in the code snippet of the tutorial......if
they are my silly mistake please do not forget to bash me as i am smart
enough to make nasty mistakes

the code snippet the and error message are as follows:


*******************CODE SNIPPET**************************

#include "Basic.h"


typedef CoredNodePtr<Group> GroupNodePtr;
typedef CoredNodePtr<Geometry> GeometryNodePtr;


//The SimpleSceneManager is a useful class which helps us to
//manage simple configurations. It will be discussed in detail later on
SimpleSceneManager *mgr;


//we have a forward declaration here, just to have a better order
//of codepieces
int setupGLUT( int *argc, char *argv[] );
void moveNode(NodePtr, NodePtr, int);
void motion(int,int);
void mouse(int,int,int,int);
void reshape(int,int);
void display();
void keyboard(unsigned char, int,int);


NodePtr createSceneGraph(void);


NodePtr createSceneGraph(void)
{
        //make the torus geometry
        GeometryNodePtr torus = GeometryNodePtr::create();
        //create a torus geometry and then assign that to 
        //core part of the CoredNodePtr<Geometry> 
        torus = makeTorusGeo(0.5,2,8,12);

        //make the box geometry
        GeometryNodePtr box = GeometryNodePtr::create();
        box = makeBoxGeo(0.5,0.5,0.5,1,1,1);

        //create the group node and the core
        GroupNodePtr root = GroupNodePtr::create();
        //creating the core
        root = Group::create();

        //add the torus and the box 
        beginEditCP(root, Group::CoreFieldMask);
                root.node()->addChild(torus);
                root.node()->addChild(box);
        endEditCP(root, Group::CoreFieldMask);


        addRefCP(root.node());


        return root.node();
}

int main(int argc, char **argv)
{
    // Init the OpenSG subsystem
    osgInit(argc,argv);
    // We create a GLUT Window (that is almost the same for most
applications)
    int winid = setupGLUT(&argc, argv);

    GLUTWindowPtr gwin = GLUTWindow::create();

    gwin->setId(winid);
    gwin->init();



    // Create and setup our little friend - the SSM
    mgr = new SimpleSceneManager();
    mgr->setWindow(gwin);
    mgr->setRoot(createSceneGraph());
    mgr->showAll();
    // Give Control to the GLUT Main Loop
    glutMainLoop();


        return 0;
}



//react to  the keys
void keyboard(unsigned char k,int x,int y)
{
        switch(k)
        {
                case 27:
                {
                        OSG::osgExit();
                        exit(0);
                }
                break;
        }
}


//react the mouse motions with pressed buttons
void motion(int x, int y)
{
        mgr->mouseMove(x,y);
        glutPostRedisplay();
}

//react to mouse button presses
void mouse(int button,int state, int x,int y)
{
        if(state)
                mgr->mouseButtonRelease(button,x,y);
        else
                mgr->mouseButtonPress(button,x,y);

        glutPostRedisplay();
}



// react to size changes
void reshape(int w, int h)
{
    mgr->resize(w, h);
    glutPostRedisplay();
}
// just redraw our scene if this GLUT callback is invoked
void display(void)
{
   /* 
    Matrix m;

    
    //get  the elapsed time since the application started
    Real32 time = glutGet(GLUT_ELAPSED_TIME);

    //set  the rotation
    m.setRotate(Quaternion(Vec3f(0,1,0),time/1000.f));

    //apply the matrix to  the transformation core
    beginEditCP(transCore, Transform::MatrixFieldMask);
       transCore->setMatrix(m);       
    endEditCP(transCore, Transform::MatrixFieldMask);
    */
    

    mgr->redraw();
}
//The GLUT subsystem is set up here. This is very similar to other GLUT
//applications. If you have worked with GLUT before, you may have the
//feeling of meeting old friends again, if you have not used GLUT before
//that is no problem. GLUT will be introduced briefly on the next section
int setupGLUT(int *argc, char *argv[])
{
    glutInit(argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    int winid = glutCreateWindow("OpenSG First Application");

    // register the GLUT callback functions
    glutDisplayFunc(display);
    glutIdleFunc(display);
    glutReshapeFunc(reshape);
    glutMotionFunc(motion);
    glutMouseFunc(mouse);
    glutKeyboardFunc(keyboard);
    return winid;

}


*************************ERROR MESSAGE *****************************'


[EMAIL PROTECTED]:~/openSG/opSG/test$ make coreOSG
g++ -D_GNU_SOURCE -DQT_CLEAN_NAMESPACE -DOSG_WITH_GLUT -DOSG_WITH_QT
-DOSG_WITH_TIF -DOSG_WITH_JPG -DOSG_WITH_PNG -D_OSG_HAVE_CONFIGURED_H_
-DQT_NO_XINERAMA -DQT_NO_XRENDER -DQT_NO_XFTFREETYPE -DQT_NO_XKB
-DQT_NO_SM_SUPPORT -DQT_NO_IMAGEIO_MNG -DQT_NO_IMAGEIO_JPEG
-DQT_NO_STYLE_AQUA -DQT_NO_STYLE_MAC -DQT_NO_STYLE_INTERLACE
-DQT_NO_STYLE_COMPACT -ansi -use_readonly_const -ftemplate-depth-100
-fPIC -O3 -DOSG_WITH_GLUT -DOSG_WITH_TIF -DOSG_WITH_JPG -DOSG_WITH_PNG
-I/usr/include/ -I/usr/include/ -I/usr/include/ -I/usr/include/GL/
-I/usr/local/include -c coreNodeTest.cpp
coreNodeTest.cpp: In function ‘osg::NodePtr createSceneGraph()’:
coreNodeTest.cpp:30: error: reference to ‘GeometryNodePtr’ is ambiguous
coreNodeTest.cpp:5: error: candidates are: typedef class
osg::CoredNodePtr<osg::Geometry> GeometryNodePtr
/usr/local/include/OpenSG/OSGGeometryBase.h:447: error:                
typedef class osg::CoredNodePtr<osg::Geometry> osg::GeometryNodePtr
coreNodeTest.cpp:30: error: reference to ‘GeometryNodePtr’ is ambiguous
coreNodeTest.cpp:5: error: candidates are: typedef class
osg::CoredNodePtr<osg::Geometry> GeometryNodePtr
/usr/local/include/OpenSG/OSGGeometryBase.h:447: error:                
typedef class osg::CoredNodePtr<osg::Geometry> osg::GeometryNodePtr
coreNodeTest.cpp:30: error: expected `;' before ‘torus’
coreNodeTest.cpp:33: error: ‘torus’ was not declared in this scope
coreNodeTest.cpp:36: error: reference to ‘GeometryNodePtr’ is ambiguous
coreNodeTest.cpp:5: error: candidates are: typedef class
osg::CoredNodePtr<osg::Geometry> GeometryNodePtr
/usr/local/include/OpenSG/OSGGeometryBase.h:447: error:                
typedef class osg::CoredNodePtr<osg::Geometry> osg::GeometryNodePtr
coreNodeTest.cpp:36: error: reference to ‘GeometryNodePtr’ is ambiguous
coreNodeTest.cpp:5: error: candidates are: typedef class
osg::CoredNodePtr<osg::Geometry> GeometryNodePtr
/usr/local/include/OpenSG/OSGGeometryBase.h:447: error:                
typedef class osg::CoredNodePtr<osg::Geometry> osg::GeometryNodePtr
coreNodeTest.cpp:36: error: expected `;' before ‘box’
coreNodeTest.cpp:37: error: ‘box’ was not declared in this scope
coreNodeTest.cpp:40: error: reference to ‘GroupNodePtr’ is ambiguous
coreNodeTest.cpp:4: error: candidates are: typedef class
osg::CoredNodePtr<osg::Group> GroupNodePtr
/usr/local/include/OpenSG/OSGGroupBase.h:216: error:                
typedef class osg::CoredNodePtr<osg::Group> osg::GroupNodePtr
coreNodeTest.cpp:40: error: reference to ‘GroupNodePtr’ is ambiguous
coreNodeTest.cpp:4: error: candidates are: typedef class
osg::CoredNodePtr<osg::Group> GroupNodePtr
/usr/local/include/OpenSG/OSGGroupBase.h:216: error:                
typedef class osg::CoredNodePtr<osg::Group> osg::GroupNodePtr
coreNodeTest.cpp:40: error: expected `;' before ‘root’
coreNodeTest.cpp:42: error: ‘root’ was not declared in this scope
coreNodeTest.cpp:45: error: ‘CoreFieldMask’ is not a member of ‘osg::Group’
coreNodeTest.cpp:48: error: ‘CoreFieldMask’ is not a member of ‘osg::Group’
make: *** [coreNodeTest.o] Error 1




NOW IF I REPLACE THE typedef with  the following statement 


CoredNodePtr<Geomtry> box/torus = CoredNodePtr<Geometry>::crate();

CoredNodePtr<Group> root = CoredNodePtr<Group>::crate();


the code compiles and runs fine................


Is that issue worth considering or i did something wrong?



Sajjad


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to