Hello,

I am new in the arena of SceneGraph and the tutorial is adding a little
bit more pain as my learning curve is getting more and more steeper.

As usual copied a code snippet from the daily build tutorial and end up
with thsse errorrs.....

[EMAIL PROTECTED]:~/openSG/opSG$ make firstOSG
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 firstOSG.cpp
firstOSG.cpp: In function ‘void moveNode(osg::NodePtr, osg::NodePtr, int)’:
firstOSG.cpp:38: error: conversion from ‘osg::NodePtr’ to non-scalar
type ‘osg::RefPtr<osg::NodePtr>’ requested
firstOSG.cpp: In function ‘int main(int, char**)’:
firstOSG.cpp:132: error: conversion from ‘osg::NodePtr’ to non-scalar
type ‘osg::RefPtr<osg::NodePtr>’ requested
firstOSG.cpp:139: error: conversion from ‘osg::NodePtr’ to non-scalar
type ‘osg::RefPtr<osg::NodePtr>’ requested
make: *** [firstOSG.o] Error 1



I am pasting the code that i have copied......



// File : 01firstapp.cpp
//what follows here is the smallest OpenSG programm possible
//most things used here are explained now or on the next few pages, so don’t
//worry if not everything is clear right at the beginning...
//Some needed include files - these will become more, believe me ;)
#include "OpenSG/OSGConfig.h"
#include "OpenSG/OSGGLUT.h"
#include "OpenSG/OSGSimpleGeometry.h"
#include "OpenSG/OSGGLUTWindow.h"
#include "OpenSG/OSGSimpleSceneManager.h"
#include "OpenSG/OSGSimpleAttachments.h"
#include "OpenSG/OSGRefPtr.h"
#include <iostream>
//In most cases it is useful to add this line, otherwise every OpenSG
command
//must be preceeded by an extra OSG::
OSG_USING_NAMESPACE

using namespace std;

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


//create a transformation core as a global variable
TransformPtr transCore;


//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 moveNode(NodePtr parent, NodePtr newparent, int childnum)
{
        //refcount++, to make sure that it survives
        RefPtr<NodePtr> c = parent->getChild(childnum);

        beginEditCP(parent);
                parent->subChild(c);
        endEditCP(parent);


        beginEditCP(newparent);
                newparent->addChild(c);
        endEditCP(newparent);
}

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();


    // This will be our whole scene for now : an incredible torus
    /*
    NodePtr torus  = makeTorus(.5, 2, 160, 160);
    NodePtr transNode = makeCoredNode<Transform>(&transCore);

    Matrix m;

   //now provide some data
   m.setIdentity();

   beginEditCP(transNode);
        //add the torus that have created by  the high-level command
        //to  the node as a children
        transNode->addChild(torus);
   endEditCP(transNode);
   */


    //
    //Instead of the torus we are now adding the grandpa hierrarchies
    /* 
    NodePtr grandpa = Node::create();
    NodePtr aunt = Node::create();
    NodePtr mother = Node::create();
    NodePtr me = Node::create();


    setName(grandpa, "Grandpa");
    setName(aunt, "Aunt");
    setName(mother, "Mother");
    setName(me, "Me");

    //now i create the hierrarchies
    //start with the root as grandpa
    beginEditCP(grandpa);
      grandpa->addChild(aunt);
      grandpa->addChild(mother);
    endEditCP(grandpa);

    beginEditCP(mother);
      mother->addChild(me);
    endEditCP(mother);

    NodePtr n;

    n = me->getParent()->getParent();


    cout << "Grandpa has " << grandpa->getNChildren().size() << "
children.";

    n = grandpa->getChild(0);
   
    cout << "Now i get my " << n->getName() << endl;
    //n = grandpa->getChildren().getValue(1);

    //cout << "Now i get my " << n->getName() << endl;
    

    //some test stuff....nothing to rener down here
    TransformPtr trans = Transform::create();
    const Char8 *c = trans->getTypeName();
    cout << "Typename : " << c << endl;

    const UInt32 id = trans->getTypeId();
    cout << "Type ID : " << id << endl;
    */

    //checking the RefPtr
    //we use  the following node and keep that alive
    RefPtr<NodePtr> a = Node::create();

    beginEditCP(a);
        a->addChild(Node::create());// the new node ref count is 1
    endEditCP(a);


    RefPtr<NodePtr> b = Node::create(); // keep  that alive too

    moveNode(a,b,0);

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




    return 0;
}

//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);
       transCore->setMatrix(m);       
    endEditCP(transCore);
   
    */

    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);
    return winid;

}




Song from the lost
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