Пример #1
0
void GUI::draw() {
    // This function draws all objects in the world and updates the OpenGL
    // canvas

    // Update physics
    //this->simulator->stepSimulation(1./60.);
    //

    glClearColor(0.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glShadeModel(GL_FLAT);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


    // Draw space image
    this->drawBackground();
    planetRotation += -0.00003f;

    // Draw moon dirt image
    //this->drawGroundBackground();
    //


    sunLight();

    entityHandler->lock();
    rocketEngineLight();
    drawPoseHistory();
    for(auto o : this->entityHandler->staticEnts) {
        Entity* e = o.second;
        e->getOpenGLObject()->draw(e->getPose());
    }
    for(auto o : this->entityHandler->dynamicEnts) {
        Entity* e = o.second;
        e->getOpenGLObject()->draw(e->getPose());
    }
    entityHandler->unlock();

    this->glCanvas->endDraw();

    // Render screen
    this->glCanvas->updateGL();

    // Listen for keyboard
    /*
    delete keyboardInput;
    keyboardInput = new KeyboardInput(this->entityHandler);
    QCoreApplication::instance()->installEventFilter(keyboardInput);
    */
}
Пример #2
0
void MyGlWindow::draw2DMap()
{
	_LUT.drawScene_3d_topview();

		// draw the camera as a 2-inch sphere (and a vertical line for user information)
	_camera->draw( _sphere_viewer, 2.0, YELLOW );
	
	// draw the camera history
	drawPoseHistory( _LUT._viewer_3d_topview, 2.0, BLUE );

	if ( snapshot->value()) {
		//SNAPSHOT_START_X = 150;
		//SNAPSHOT_START_Y = 200;
		 _LUT._viewer_3d_topview.screenshot( _timestamp, SNAPSHOT_X, SNAPSHOT_Y, SNAPSHOT_W, SNAPSHOT_H);
		_timestamp++;
	}
	
}