예제 #1
0
void PoslvControl::renderView(View& view) {
  if (_ui->showPathCheckBox->isChecked())
    renderPath(view, _palette.getColor("Path"));
  if (_ui->showAxesCheckBox->isChecked())
    renderAxes(view, _palette.getColor("Axes"), 0.5);
  if (_ui->showVelocityCheckBox->isChecked())
    renderVelocity(view, _palette.getColor("Velocity"));
  if (_ui->showAccelerationCheckBox->isChecked())
    renderAcceleration(view, _palette.getColor("Acceleration"));
}
예제 #2
0
void LinePlot::render() {
    outport_.activateTarget();
    plotLib_.setUsePlotPickingManager(false);
    setPlotStatus();
    if (plotLib_.setOpenGLStatus()) {
        renderAxes();
        if (regenDataList_) {
            glNewList(dataList_, GL_COMPILE);
                renderData();
            glEndList();
            regenDataList_ = false;
        }
        glCallList(dataList_);
        createLineLabels();
        plotLib_.renderLineLabels();
        createPlotLabels();
        plotLib_.renderPlotLabels();
        renderPlotLabel();
        renderMousePosition();
    }
    plotLib_.resetOpenGLStatus();
    renderSelectedRegion();
    outport_.deactivateTarget();
    plotPickingManager_.activateTarget();
    plotPickingManager_.clearTarget();
    if (enablePicking_.get()) {
        plotLib_.setUsePlotPickingManager(true);
        if (plotLib_.setOpenGLStatus() && regenPickingList_) {
            glNewList(pickingList_, GL_COMPILE);
                renderData();
            glEndList();
            regenPickingList_ = false;
        }
        glCallList(pickingList_);
        plotLib_.resetOpenGLStatus();
    }
    plotPickingManager_.deactivateTarget();
}
예제 #3
0
void BarPlot::render() {
    outport_.activateTarget();
    plotLib_.setUsePlotPickingManager(false);
    setPlotStatus();
    if (plotLib_.setOpenGLStatus()) {
        renderData();
        createPlotLabels();
        plotLib_.renderPlotLabels();
        renderPlotLabel();
        renderAxes();
    }
    plotLib_.resetOpenGLStatus();
    outport_.deactivateTarget();
    plotPickingManager_.activateTarget();
    plotPickingManager_.clearTarget();
    if (enablePicking_.get()) {
        plotLib_.setUsePlotPickingManager(true);
        if (plotLib_.setOpenGLStatus())
            renderData();
        plotLib_.resetOpenGLStatus();
    }
    plotPickingManager_.deactivateTarget();
}
예제 #4
0
void
Engine::render(void)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	this->camera->look();

	renderAxes();

//	this->renderShape();

 	renderPointArray(0, PARTY_START);

 	glEnable(GL_LIGHTING); // light ON
	renderTriangleArray(PARTY_START, PARTY_SIZE);

	if (this->moving == true)
		moveYourBody(PARTY_START, PARTY_SIZE);

 	glDisable(GL_LIGHTING); // light OFF

	glFlush();
}
예제 #5
0
void OrientationOverlay::process() {
    if (!inport_.isReady())
        outport_.activateTarget();
    else
        privatePort_.activateTarget();

    //draw the cube in the desired position
    // set modelview and projection matrices
    MatStack.matrixMode(tgt::MatrixStack::PROJECTION);
    MatStack.pushMatrix();

    MatStack.loadMatrix(tgt::mat4::createOrtho(-1,1,1,-1,-2,2));

    MatStack.matrixMode(tgt::MatrixStack::MODELVIEW);
    MatStack.pushMatrix();
    MatStack.translate(shiftX_.get()*2.0f-1.0f, shiftY_.get()*2.0f-1.0f, 0);
    tgt::mat4 view = camera_.get().getViewMatrix().getRotationalPart();

    MatStack.scale((float)outport_.getSize().y / (float)outport_.getSize().x, 1, 1);

    MatStack.multMatrix(view);

    glClearDepth(1);

    glEnable(GL_DEPTH_TEST);
    glDisable(GL_LIGHTING);

    // render cube and axis overlays
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    if (drawCube_.get() == true)
        renderCube();
    if (drawAxes_.get() == true)
        renderAxes();

    if (!inport_.isReady())
        outport_.deactivateTarget();
    else
        privatePort_.deactivateTarget();

    // restore OpenGL state
    glCullFace(GL_BACK);
    glDisable(GL_CULL_FACE);
    MatStack.matrixMode(tgt::MatrixStack::PROJECTION);
    MatStack.popMatrix();
    MatStack.matrixMode(tgt::MatrixStack::MODELVIEW);
    MatStack.popMatrix();
    LGL_ERROR;

    glEnable(GL_DEPTH_TEST);

    // now do the composition of the OrientationOverlay with the inport render data by shader
    if (inport_.isReady()) {
        outport_.activateTarget();
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        // use the shader to draw cube and axis over inport render data
        // therefore bind rgba and depth values of both to textures
        TextureUnit colorUnit0, depthUnit0, colorUnit1, depthUnit1;
        privatePort_.bindTextures(colorUnit0.getEnum(), depthUnit0.getEnum());
        inport_.bindTextures(colorUnit1.getEnum(), depthUnit1.getEnum());

        // initialize shader
        program_->activate();
        setGlobalShaderParameters(program_);
        program_->setUniform("colorTexMe_", colorUnit0.getUnitNumber());
        program_->setUniform("depthTexMe_", depthUnit0.getUnitNumber());
        program_->setUniform("colorTexIn_", colorUnit1.getUnitNumber());
        program_->setUniform("depthTexIn_", depthUnit1.getUnitNumber());
        privatePort_.setTextureParameters(program_, "textureParametersMe_");
        inport_.setTextureParameters(program_, "textureParametersIn_");

        glDepthFunc(GL_ALWAYS);
        renderQuad(); // render quad primitive textured by fragment shader
        glDepthFunc(GL_LESS);
        outport_.deactivateTarget();

        program_->deactivate();
        glActiveTexture(GL_TEXTURE0);
    }

    LGL_ERROR;
}