コード例 #1
0
ファイル: testApp.cpp プロジェクト: roikr/openFrameworks007
//--------------------------------------------------------------
void testApp::draw(){
    
    switch (state) {
        case STATE_TENT:
            drawTent();
            break;
        case STATE_MODEL:
            drawModel();
            break;
        case STATE_SCREEN:
            drawScreen();
            break;
        default:
            break;
    }

        
    switch (state) {
        
        case STATE_TENT:
        case STATE_MODEL: {
            ofSetColor(255);
            string msg = string("Using mouse inputs to navigate ('m' to toggle): ") + (cam.getMouseInputEnabled() ? "YES" : "NO");
            msg += "\nfps: " + ofToString(ofGetFrameRate(), 2);
            ofDrawBitmapString(msg, 10, 20);
        } break;
        case STATE_SCREEN:

            break;
        default:
            break;
    }
	
}
コード例 #2
0
ファイル: StupidMain.cpp プロジェクト: acompania/T-Rex-Game
/* Main display function */
void Draw (void)
{
   glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   //Start our shader   
   glUseProgram(ShadeProg);
   
   SetModelI();
   /* Set up the projection and view matrices */
   SetProjectionMatrix();
   SetView();

   /* Set up the light's direction and color */
   glUniform3f(h_uLightColor, sunShade.x, sunShade.y, sunShade.z);
   glUniform3f(h_uSun, sunDir.x, sunDir.y, sunDir.z);

   // set the normal flag
   glUniform1i(h_uShadeType, g_shadeType);

 // ======================== draw square stuff =========================

      drawModel(&bunnyModel);

 // ================== end of bird stuff ====================

   //clean up 
   safe_glDisableVertexAttribArray(h_aPosition);
   safe_glDisableVertexAttribArray(h_aNormal);

   //disable the shader
   glUseProgram(0);
}
コード例 #3
0
ファイル: model.cpp プロジェクト: JohnCrash/wowmapviewer
void Model::draw()
{
	if (!ok) return;

	if (!animated) {
		glCallList(dlist);
	} else {
		if (ind) animate(0);
		else {
			if (!animcalc) {
				animate(0);
				animcalc = true;
			}
		}
		lightsOn(GL_LIGHT4);
        drawModel();
		lightsOff(GL_LIGHT4);

		// effects are unfogged..?
		glDisable(GL_FOG);

		// draw particle systems
		for (size_t i=0; i<header.nParticleEmitters; i++) {
			particleSystems[i].draw();
		}

		// draw ribbons
		for (size_t i=0; i<header.nRibbonEmitters; i++) {
			ribbons[i].draw();
		}

		if (gWorld && gWorld->drawfog) glEnable(GL_FOG);
	}
}
コード例 #4
0
void drawScene3D()
{
    // setup projection
    #ifdef TEST_PROJECTION_MORPHING
    updateProjection();
    #endif

    glMatrixMode(GL_PROJECTION);
    auto proj = projection.ToMatrix4();
    glLoadMatrix_T(proj.Ptr());

    // update view matrix
    glMatrixMode(GL_MODELVIEW);
    viewMatrix = cameraTransform.GetMatrix().Inverse();

    // update view frustum
    updateFrustum();

    // draw models
    for (const auto& mdl : models)
    {
        drawModel(mdl);
        drawAABB(mdl.mesh.BoundingBox(mdl.transform.GetMatrix()));
    }
}
コード例 #5
0
//--------------------------------------------------------------------------------
void GLWidget::paintGL()
{
  glEnable(GL_LIGHTING);
  glEnable(GL_COLOR_MATERIAL);
  glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  Vector3F viewPoint = scene.camera.Eye() + scene.camera.Focus();

  // Camera position
  glLoadIdentity();
  gluLookAt(scene.camera.Eye().X, scene.camera.Eye().Y, scene.camera.Eye().Z,
            viewPoint.X, viewPoint.Y, viewPoint.Z,
            scene.camera.Up().X, scene.camera.Up().Y, scene.camera.Up().Z);

  drawModel();

  // Turn off lights
  glDisable(GL_LIGHTING);

  if (boundingBoxVisible_)
    drawBoundingBoxes();

  if (cameraRayVisible_)
    drawCameraRay();
}
コード例 #6
0
ファイル: topaz.cpp プロジェクト: fetchhell/topaz
void TopazSample::drawStandard()
{
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_POLYGON_OFFSET_FILL);
	glPolygonOffset(1, 1);

	glBindBufferBase(GL_UNIFORM_BUFFER, UBO_SCENE, ubos.sceneUbo);
	
	shaderPrograms["draw"]->enable();
	{
		const char* uniformNames[] = { "objectData.objectID", "objectData.objectColor", "objectData.skybox", "objectData.pattern" };

		std::unique_ptr<GLint>  parameters(new GLint[4]);
		std::unique_ptr<GLuint> uniformIndices(new GLuint[4]);

		glGetUniformIndices(shaderPrograms["draw"]->getProgram(), 4, uniformNames, uniformIndices.get());
		glGetActiveUniformsiv(shaderPrograms["draw"]->getProgram(), 4, uniformIndices.get(), GL_UNIFORM_OFFSET, parameters.get());

		GLint* offset = parameters.get();
		CHECK_GL_ERROR();
	}

	for (auto & model : models)
	{
		drawModel(GL_TRIANGLES, *shaderPrograms["draw"], *model);
	}

	CHECK_GL_ERROR();
}
コード例 #7
0
void ComponentRenderAsModel::draw() const
{
	if(!dead || getDeathBehavior()!=Ghost)
	{
		ASSERT(model, "Null pointer: model");

		const float modelScale = lastReportedHeight / modelHeight;

		CHECK_GL_ERROR();

		mat4 transformation(lastReportedPosition,
		                    lastReportedOrientation.getAxisX(),
		                    lastReportedOrientation.getAxisY(),
		                    lastReportedOrientation.getAxisZ());

		glPushMatrix();
		glMultMatrixf(transformation);
		glTranslatef(0.0f, 0.0f, -lastReportedHeight/2.0f);
		glScalef(modelScale, modelScale, modelScale);
		glPushAttrib(GL_ALL_ATTRIB_BITS);
		drawModel(true);
		glPopAttrib();
		glPopMatrix();

		CHECK_GL_ERROR();
	}
}
コード例 #8
0
ファイル: GLWidget.cpp プロジェクト: adickin/Md2-Viewer
/*
***************************************************************
*
*  Function called everytime updateGL() is called.  Draws the
*  models with textures, as well as vertex's, ground sheets if
*  enabled.
*
***************************************************************
*/
void GLWidget::paintGL()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glColor3f(1.0, 1.0, 1.0);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    if(QString("Perspective") == projectionSelected_)
    {
        viewChanger_->setPerspective(windowWidth_, windowHeight_);
    }
    else if(QString("Parallel") == projectionSelected_)
    {
        viewChanger_->setParallel(modelReader_.dimensions());
    }

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    if(QString("Perspective") == projectionSelected_)
    {
        viewChanger_->setViewPosition();
    }

    glPushMatrix();

    if(drawGroundSheet_)
    {
        glPushMatrix();
        drawGroundSheet();
        glPopMatrix();
    }

    //Rotate the model to be upright.
    glRotatef(-90.0, 0.0, 0.0, 1.0);
    glRotatef(-90.0, 0.0, 1.0, 0.0);

    transformer_->performScalingOnModel();
    transformer_->performTranslationOnModel();
    glMultMatrixf(transformer_->matrix());
    drawModel();

    if(drawVertexNormals_)
    {
        glPushMatrix();
        drawModelVertexNormals();
        glPopMatrix();
    }
    if(drawFaceNormals_)
    {
        glPushMatrix();
        drawModelFaceNormals();
        glPopMatrix();
    }
    glPopMatrix();


    glFlush();
}
コード例 #9
0
ファイル: MyModel.cpp プロジェクト: thebandrews/modeler_impl
/** Draw the scene. */
void MyModel::draw() {

    // Use the texture if desired.
    texture.use();

    // Call a class method that draws our model.
    drawModel();

    // This if-statement makes sure that glUseProgram is not a null
    // function pointer (which it will be if GLEW couldn't initialize).
    if (glUseProgram) {
        glUseProgram(0);
    }

    // Stop applying textures to objects
    glBindTexture(GL_TEXTURE_2D, 0);



    //
    // Draw sky
    //
    sky.use();
    glPushMatrix();
    glRotatef(90, 0, 1, 0);
    drawSphere(200);
    glPopMatrix();

    glBindTexture(GL_TEXTURE_2D, 0);

    //
    // Draw the floor
    //
    grass.use();

    glBegin(GL_QUADS);
    glTexCoord2f(0, 1); // specify the texture coordinate
    glNormal3f(0, 1, 0); // specify the surface's normal at this vertex
    glVertex3f(-50, -2, -50); // both before its corresponding vertex

    glTexCoord2f(1, 1);
    glNormal3f(0, 1, 0);
    glVertex3f(50, -2, -50);

    glTexCoord2f(1, 0);
    glNormal3f(0, 1, 0);
    glVertex3f(50, -2, 50);

    glTexCoord2f(0, 0);
    glNormal3f(0, 1, 0);
    glVertex3f(-50, -2, 50);
    glEnd();

    // Stop applying textures to objects
    glBindTexture(GL_TEXTURE_2D, 0);
}
コード例 #10
0
ファイル: dude.c プロジェクト: iamscottmoyers/cambhaxx-gles
static void display(void)
{
	glClearColor(0.0, 0.0, 0.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	glTranslatef( 0, -2, -7 );
	glRotatef(angle, 0.0, 1.0, 0.0);
	glScalef(0.25,0.25,0.25);
	glTranslatef( 0, 0, -10 );
	drawModel(model);
}
コード例 #11
0
ファイル: OpenGLGame.cpp プロジェクト: jvitale94/3D-Game
 virtual void draw()
 {
     material->apply();
     // apply scaling, translation and orientation
     glMatrixMode(GL_MODELVIEW);
     glPushMatrix();
     glTranslatef(position.x, position.y, position.z);
     glRotatef(orientationAngle, orientationAxis.x, orientationAxis.y, orientationAxis.z);
     glScalef(scaleFactor.x, scaleFactor.y, scaleFactor.z);
     drawModel();
     glPopMatrix();
 }
コード例 #12
0
ファイル: wzmglwidget.cpp プロジェクト: C1annad/warzone2100
void WZMOpenGLWidget::draw()
{
	if (psModel)
	{
		if (animation)
		{
			now = timer.elapsed();
		}

		drawModel(psModel, now, selectedMesh);
	}
}
コード例 #13
0
ファイル: starship.cpp プロジェクト: jennydvr/StarTroupial
void starship::draw(GLenum mode, int ident) {
    // Every 50 miliseconds update texturize
    if (glutGet(GLUT_ELAPSED_TIME) - previousText >= 50) {
        previousText = glutGet(GLUT_ELAPSED_TIME);
        texturize = !texturize;
    }
    
    glPushMatrix();
        glTranslatef(x, y, z);
        drawModel(glutGet(GLUT_ELAPSED_TIME) - previousInv < 2000 && !texturize);
    glPopMatrix();
    
    object::draw();
}
コード例 #14
0
ファイル: Aircraft.cpp プロジェクト: dlsyaim/gradthes
// Attention: This function needs to be consummated
void Aircraft::drawWithInstruments(const RECT &rect)
{
	// When the client area minimized, just return.
	if (rect.right == 0 || rect.bottom == 0)
		return;

	// Calculate the differences
	float diff = calculateDifferences(rect);
	z_ = z_ + diff;
	y_ = -50.0f;
	x_ = 300.0f;

	drawModel();
}
コード例 #15
0
ファイル: mower.cpp プロジェクト: minime283/Lawnmower
void Mower::draw()
{
	glPushMatrix();
		glTranslatef(this->lright,0,this->lup);
		glTranslatef(0,0,0);
		glScalef(0.1,0.1,0.1);
		glTranslatef(4.0f,0,8.0f);
		glRotatef(this->lrotation,0,1,0);
		glTranslatef(-4.0f,0,-8.0f);
		glPushMatrix();
		drawModel(); //Draw Lawnmower
		glPopMatrix();
	glPopMatrix();
}
コード例 #16
0
RenderController::RenderController(MainWindow *mainWindow,
                                   QObject *parent):
    QObject(parent)
{
    this->mainWindow = mainWindow;

    light = new DirectionalLight;
    arcBall = new ArcBall(500);
    wireframe = false;
    lightRotation = false;

    this->display = new GLDisplay();
    mainWindow->setGLDisplay(display);
    {  // esta ordem deve ser mantida
        display->updateGL();

        scene = new Scene3D(mainWindow);

        connect(display, SIGNAL(drawModel()), this, SLOT(drawModel()));
        connect(display, SIGNAL(lightSetup()), this, SLOT(lightSetup()));
    }

    connect(display, SIGNAL(mouseLefthFinish(QPoint,QPoint)), this, SLOT(mouseLefthFinish(QPoint,QPoint)));
    connect(display, SIGNAL(mouseLeftMove(QPoint,QPoint)), this, SLOT(mouseLeftMove(QPoint,QPoint)));
    connect(display, SIGNAL(mouseCancel()),
            this, SLOT(mouseCancel()));

    connect(mainWindow, SIGNAL(loadWave(QString)), this, SLOT(loadWave(QString)));
    connect(mainWindow, SIGNAL(saveWave(QString)), this, SLOT(saveWave(QString)));
    connect(mainWindow->actionClose, SIGNAL(triggered()), this, SLOT(closeScene()));
    connect(mainWindow->actionWireFrame, SIGNAL(triggered()), this, SLOT(wireFrameToggle()));

    connect(&timer, SIGNAL(timeout()), this, SLOT(timeOut()));
    timer.start(30);

    mainWindow->showMaximized();
}
コード例 #17
0
ファイル: main.c プロジェクト: iamscottmoyers/cambhaxx-gles
static void display(void)
{
	glClearColor(0.0, 0.0, 0.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();

	/* Set inital view point and rotation */
	glTranslatef(_x, _y, _z);
	glRotatef(_r, _rx, _ry, _rz);

	/* Initialise glut keyboard input */
	glutKeyboardFunc(keyboard);
	drawModel(model);
	glFlush();
}
コード例 #18
0
ファイル: cboard.cpp プロジェクト: adarshaj/AirHockey
void CBoard::draw( ){ 
	// glColor3f( 0.3, 0.3, 0.3 );
	drawModel( r, g, b );

	board_texture.bindTexture( );
	glColor3f( 1.0, 1.0, 1.0 );
	glBegin( GL_QUADS ); 
	glTexCoord2f( 0.0, 0.0 );	 glVertex3f( -width/2.0, -length/2.0, 0.5 ); 
	glTexCoord2f( 1.0, 0.0 );	 glVertex3f( width/2.0, -length/2.0, 0.5 ); 
	glTexCoord2f( 1.0, 1.0 );	 glVertex3f( width/2.0, length/2.0, 0.5 ); 
	glTexCoord2f( 0.0, 1.0 );	 glVertex3f( -width/2.0, length/2.0, 0.5 ); 
	glEnd( );
	board_texture.unbindTexture( );

	return; 
}
コード例 #19
0
ファイル: Buggy.cpp プロジェクト: faturita/wakuseibokan
void Buggy::drawDirectModel()
{
    float modX=0.0f, modY=15.0f, modZ=0.0f;
    
    modX = pos[0];
    modY = pos[1];
    modZ = pos[2];
    
    Vec3f forward = toVectorInFixedSystem(0, 0, -0.1,-xRotAngle,yRotAngle);
    
    modX+=speed*forward[0]; modY+=speed*forward[1];modZ+=speed*forward[2];
    
    pos += speed * forward;
    
    drawModel(xRotAngle, yRotAngle, modX, modY, modZ);
}
コード例 #20
0
ファイル: Object.cpp プロジェクト: kujenga/worldsurfer
void Object::drawShadow(float3 lightDir)
{
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    // scale down to shadow shape
    
    lightDir.x = lightDir.x * position.y/lightDir.y;
    lightDir.z = lightDir.z * position.y/lightDir.y;
    glTranslatef(lightDir.x, 0.2, lightDir.z);
    glScalef(1, 0, 1);
    
    glTranslatef(position.x, position.y, position.z);
    glRotatef(orientationAngle, orientationAxis.x, orientationAxis.y, orientationAxis.z);
    glScalef(scaleFactor.x, scaleFactor.y, scaleFactor.z);
    drawModel();
    glPopMatrix();
}
コード例 #21
0
void drawScene()
{
    // setup projection
    auto proj = projection.ToMatrix4();
    glMatrixMode(GL_PROJECTION);
    glLoadMatrixf(proj.Ptr());

    // update view matrix
    glMatrixMode(GL_MODELVIEW);
    viewMatrix = viewTransform.GetMatrix().Inverse();

    // draw models
    if (selectedModel)
    {
        drawModel(*selectedModel);
        if (showBox)
            drawAABB(selectedModel->mesh.BoundingBox(selectedModel->transform.GetMatrix()));
    }
}
コード例 #22
0
// This function draws to the screen
static void RenderScreen(){

        TFT_Fill_Screen(bg_color);

        computeXform();    //calculate translation matrix

        drawModel();     //render polygons to LCD


        TFT_Write_Text(rotationString, 10, 240-25);   //write the rotation values

        Delay_ms(50);

        //increment the current frame number
        frame_counter++;

        //Save the settings from the previous frame
        SavePrevious(); 
}
コード例 #23
0
void drawRecognizerShadow(void) {
  float dirx;
  vec2 p, v;
  /* states */

  glEnable(GL_CULL_FACE);
  if(gSettingsCache.use_stencil) {
    glEnable(GL_STENCIL_TEST);
    glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
    glStencilFunc(GL_GREATER, 1, 1);
    glEnable(GL_BLEND);
    glColor4fv(shadow_color);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  } else {
    glColor3f(0, 0, 0);
    glDisable(GL_BLEND);
  }
  
  /* transformations */
  getRecognizerPositionVelocity(&p, &v);
  dirx = getRecognizerAngle(&v);

  glPushMatrix();
  glMultMatrixf(shadow_matrix);
  glTranslatef( p.v[0], p.v[1], RECOGNIZER_HEIGHT);
  glRotatef(dirx, 0, 0, 1); /* up */
  glScalef(rec_scale_factor, rec_scale_factor, rec_scale_factor);
  glEnable(GL_NORMALIZE);

  /* render */

  drawModel(recognizer, TRI_MESH);

  /* restore */

  if(gSettingsCache.use_stencil)
    glDisable(GL_STENCIL_TEST);

  glDisable(GL_BLEND);
  glDisable(GL_CULL_FACE);
  glPopMatrix();
}
コード例 #24
0
ファイル: model.cpp プロジェクト: JohnCrash/wowmapviewer
void Model::initStatic(MPQFile &f)
{
	origVertices = (ModelVertex*)(f.getBuffer() + header.ofsVertices);

	initCommon(f);

	dlist = glGenLists(1);
	glNewList(dlist, GL_COMPILE);

    drawModel();

	glEndList();

	// clean up vertices, indices etc
	delete[] vertices;
	delete[] normals;
	delete[] indices;

	if (colors) delete[] colors;
	if (transparency) delete[] transparency;
}
コード例 #25
0
void PlotWidget::draw( Project &p, ScheduleManager &sm ) 
{
   return drawModel( p, sm );
   
    // Retrieve data
    mKpoBCWP->clearPoints();
    mKpoBCWS->clearPoints();
    mKpoACWP->clearPoints();
    
    chartEngine.calculateData(p,sm);
    
    // setting our limits for the plot
    setLimits( 0.0, chartEngine.getMaxTime(), 0.0, chartEngine.getMaxCost() );
    
    for (QVector<QPointF>::iterator iterData = chartEngine.mBCWPPoints.begin() ; iterData != chartEngine.mBCWPPoints.end(); ++iterData )
        mKpoBCWP->addPoint( iterData->x(), iterData->y() );

    for (QVector<QPointF>::iterator iterData = chartEngine.mBCWSPoints.begin() ; iterData != chartEngine.mBCWSPoints.end(); ++iterData )
        mKpoBCWS->addPoint( iterData->x(), iterData->y() );

    for (QVector<QPointF>::iterator iterData = chartEngine.mACWPPoints.begin() ; iterData != chartEngine.mACWPPoints.end(); ++iterData )
        mKpoACWP->addPoint( iterData->x(), iterData->y() );
}
コード例 #26
0
ファイル: OpenGLGame.cpp プロジェクト: jvitale94/3D-Game
    virtual void drawShadow(float3 lightDir)
    {
        
        glMatrixMode(GL_MODELVIEW);
        glPushMatrix();

        glTranslatef(0, 0.01, 0);
        glScalef(1, 0.01, 1);
        
        glTranslatef(position.x, position.y, position.z);
        glRotatef(orientationAngle, orientationAxis.x, orientationAxis.y, orientationAxis.z);
        glScalef(scaleFactor.x, scaleFactor.y, scaleFactor.z);
        
        float shear[] = {
            1, 0, 0, 0,
            lightDir.x/lightDir.y, 1, lightDir.z/lightDir.y, 0,
            0, 0, 1, 0,
            0, 0, 0, 1 };
        glMultMatrixf(shear);
        
        
        drawModel();
        glPopMatrix();
    }
コード例 #27
0
ファイル: main.cpp プロジェクト: mawbye/graphicsgame
	virtual void drawShadow(float3 lightDir) {
		if (!collected)
		{
			float projectToPlane[] = {
				1, 0, 0, 0,
				(-lightDir.x / lightDir.y) , 0, (-lightDir.z / lightDir.y) , 0,
				0, 0, 1, 0,
				0, .1, 0, 1 };
			glMatrixMode(GL_MODELVIEW);
			glPushMatrix();
			glMultMatrixf(projectToPlane);
			glTranslatef(position.x, position.y, position.z);
			glRotatef(orientationAngle, orientationAxis.x, orientationAxis.y, orientationAxis.z);
			glScalef(scaleFactor.x, scaleFactor.y, scaleFactor.z);




			drawModel();
			glPopMatrix();
		}
		
	
	};
コード例 #28
0
ファイル: GameObjectBomb.cpp プロジェクト: thmoa/ChiliSensics
/* 
* draw
* zeichnet model an bestimmter Position mit bestimmter Orientierung
*/
void GameObjectBomb::draw() {
	btVector3 trans = getPosition();
	btQuaternion ori = getOrientation();
	SQuaternion4d m_ori;
	CMatrix * modelviewmatrix = getModelView();

	m_ori.x = ori.getAxis().getX();
	m_ori.y = ori.getAxis().getY();
	m_ori.z = ori.getAxis().getZ();
	m_ori.w = ori.getAngle();

	modelviewmatrix->Push();

	if (status == statusExplosion) {
		modelviewmatrix->Scale(1.0+animationStep/10.0, 1.0+animationStep/10.0, 1.0+animationStep/10.0);
	}

	modelviewmatrix->Rotate(ori.getAngle() ,ori.getAxis().getX(),ori.getAxis().getY(),ori.getAxis().getZ());
	modelviewmatrix->Translate(trans.getX(),trans.getY(),trans.getZ());

	drawModel();
	modelviewmatrix->Pop();

}
コード例 #29
0
void SceneRenderer::drawScene(GLint positionAttrib, GLint normalAttrib)
{
    drawFloor(positionAttrib, normalAttrib);

    drawModel(positionAttrib, normalAttrib);
}
コード例 #30
0
ファイル: interactive.c プロジェクト: bareqsh/SBML_odeSolver
void
interactive() {
  
  char *sbmlFilename;
  char *select;
  int quit;
  SBMLDocument_t *d  = NULL;
  Model_t        *m  = NULL;
  odeModel_t *om     = NULL;
  cvodeData_t * data = NULL;
  integratorInstance_t *ii = NULL;
  cvodeSettings_t *set = NULL;

  printf("\n\nWelcome to the simple SBML ODE solver.\n");
  printf("You have entered the interactive mode.\n");
  printf("All other commandline options have been ignored.\n");
  printf("Have fun!\n\n");

  initializeOptions();
  /* reset steady state */
  Opt.SteadyState = 0;
  /* activate printing of results to XMGrace */
  Opt.Xmgrace = 1;
  /* activate printing integrator messages */
  Opt.PrintMessage = 1;
  /* deactivate on the fly printing of results */
  Opt.PrintOnTheFly = 0;

  sbmlFilename = concat(Opt.ModelPath, Opt.ModelFile);

  if ( (d = parseModelWithArguments(sbmlFilename)) == 0 )
  {
    Warn(stderr, "%s:%d interactive(): Can't parse Model >%s<",
	  __FILE__, __LINE__, sbmlFilename);
    d = loadFile();
  }

  /* load models and default settings */
  m = SBMLDocument_getModel(d);
  om = ODEModel_create(m);
  set = CvodeSettings_create();
  SolverError_dumpAndClearErrors();
  
  quit = 0;
  data = NULL;
  
  while ( quit == 0 ) {

    printf("\n");
    printf("Press (h) for instructions or (q) to quit.\n");
    printf("> ");
    select = get_line( stdin );
    select = util_trim(select);
    printf("\n");

    if( strcmp(select,"l") == 0 ) {
      /* free all existing structures */
      if ( om != NULL )
	ODEModel_free(data->model);
      if ( d != NULL )
	SBMLDocument_free(d);
      if ( ii != NULL )
	IntegratorInstance_free(ii);

      /* load a new file */
      d = loadFile();
      
      /* load new models */
      m = SBMLDocument_getModel(d);
      om = ODEModel_create(m);
      SolverError_dumpAndClearErrors();            
    }

    if(strcmp(select,"h")==0)
      printMenu();
    
    if(strcmp(select,"s")==0)
      printModel(m, stdout);
    
    if(strcmp(select,"c")==0)
      printSpecies(m, stdout);
    
    if(strcmp(select,"r")==0)
      printReactions(m, stdout);
    
    if(strcmp(select,"o")==0)
      printODEs(om, stdout);

    /* integrate interface functions, asks for time and printsteps */
    if(strcmp(select,"i")==0){
      ii = callIntegrator(om, set);
      SolverError_dumpAndClearErrors();
    }

    if(strcmp(select,"x")==0){
      if ( Opt.Xmgrace == 1 ) {
	Opt.Xmgrace = 0;
	printf(" Printing results to stdout\n");
      }
      else if ( Opt.Xmgrace == 0 ) {
	Opt.Xmgrace = 1;
	printf(" Printing results to XMGrace\n");
      }
    }      
    if(strcmp(select,"st")==0)
      printConcentrationTimeCourse(ii->data, stdout);
    
    if(strcmp(select,"jt")==0)
      printJacobianTimeCourse(ii->data, stdout);

    
    if(strcmp(select,"ot")==0)
      printOdeTimeCourse(ii->data, stdout);

    
    if(strcmp(select,"rt")==0)
      printReactionTimeCourse(ii->data, m, stdout);
    
    if(strcmp(select,"xp")==0)
      printPhase(ii->data);
    
    
    if(strcmp(select,"set")==0)
      setValues(m);
    
    
    if(strcmp(select,"ss")==0){
      if ( Opt.SteadyState == 1 ) {
	Opt.SteadyState = 0;
	printf(" Not checking for steady states during integration.\n");
      }
      else if ( Opt.SteadyState == 0 ) {
	Opt.SteadyState = 1;
	printf(" Checking for steady states during integration.\n");
      }
    }

    if(strcmp(select,"uj")==0){
      if ( Opt.Jacobian == 1 ) {
	Opt.Jacobian = 0;
	printf(" Using CVODE's internal approximation\n");
	printf(" of the jacobian matrix for integration\n");
      }
      else if ( Opt.Jacobian == 0 ) {
	Opt.Jacobian = 1;
	printf(" Using automatically generated\n");
	printf(" jacobian matrix for integration\n");
      }
    }
    
    if(strcmp(select,"gf")==0)
      setFormat();
    
    if(strcmp(select,"rg")==0) {
      drawModel(m, sbmlFilename, Opt.GvFormat);
      SolverError_dumpAndClearErrors();
    }
    
    if(strcmp(select,"jg")==0){
      if ( ii == NULL ) {
	data = CvodeData_create(om);
	CvodeData_initialize(data, set, om, 0);
	drawJacoby(data, sbmlFilename, Opt.GvFormat);
	SolverError_dumpAndClearErrors();
	CvodeData_free(data);
      }
      else {
	drawJacoby(ii->data, sbmlFilename, Opt.GvFormat);
	SolverError_dumpAndClearErrors();
      }
    }

    
    if(strcmp(select,"j")==0) {
      if ( om->jacob == NULL )
	ODEModel_constructJacobian(om);
      printJacobian(om, stdout);
    }

    
    if(strcmp(select,"q")==0)
      quit = 1;
    
  }

  if ( ii != NULL )
    IntegratorInstance_free(ii);
  if ( om != NULL ) 
    ODEModel_free(om);

  SBMLDocument_free(d);
  SolverError_dumpAndClearErrors();
  printf("\n\nGood Bye. Thx for using.\n\n");
}