eXperiment robotics framework

Creating a world object:

Here is the simplest example possible, the Ground Object3D that is a plane with a Tag "ground" that can be clicked. This is the header.
struct Ground: public Object3D {
    Ground();
};

And this is the implementation. The first argument to the constructor is asking the Manager of opengl names to create a unique id for it, and the second argument is giving it a Tag. Then the object is added to the manager of opengl names so that it can be clicked into.

Ground::Ground(): Object3D(MGLNames.newId(),"ground") {
    MGLNames.addObject3D(this);
}

Creating opengl displaylists:

displaylist_ground = MGLLists.newGLList("ground");
glNewList(displaylist_ground, GL_COMPILE);
glRectf(-10000,-10000,10000,10000);
glEndList();

Displaying:

ERF then needs to known where the object starts and ends. We do this by surrounding the drawing code with a pushname in the following way.

glPushName(ground->getId());
glCallList(displaylist_ground);
glPopName();

That is it, the object is ready to be clicked.

Loading meshes:

void Laser::load(XE* xe_in){
   laserobj=getString(xe_in,"skinFile","");
}

void init(){
    if (laserobj!="") {
        displaylist_laser = MGLLists.addModel(laserobj.c_str());
    };
}

void draw(){
    glCallList(displaylist_laser);
}

The miarn project - written by Joao Xavier