Example #1
0
void Scenario::render() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    renderGround();
    renderLines();
    renderGoal();
}
Example #2
0
void render()            
{
	PROFILE;
	renderBg();

    for ( int i=0; i<numItems(); i++ )
    {
		Item * it = getItem(i);
		for ( int j=0; j<it->ncon; j++ )
		{
			if ( ! it->con[j] )
				continue;
		    renderLines( it->con[j], it, 0 );   
		}

	}    
    for ( int i=0; i<numItems(); i++ )
    {
		renderNames(getItem(i), 0, 0 );   
	}

	startTex();
    for ( int i=0; i<numItems(); i++ )
    {
        renderIt( getItem(i), 0, 0 );
    }
    endTex();
}
void TNMParallelCoordinates::process() {
	// Activate the user-outport as the rendering target
    _outport.activateTarget();
	// Clear the buffer
    _outport.clearTarget();

	// Render the handles
    renderHandles();
	// Render the parallel coordinates lines
    renderLines();

	// We are done with the visual part
    _outport.deactivateTarget();

	// Activate the internal port used for picking
    _privatePort.activateTarget();
	// Clear that buffer as well
    _privatePort.clearTarget();
	// Render the handles with the picking information encoded in the red channel
    renderHandlesPicking();
	// Render the lines with the picking information encoded in the green/blue/alpha channel
	renderLinesPicking();
	// We are done with the private render target
    _privatePort.deactivateTarget();
}
Example #4
0
inline void FXGLVertices::render(FXGLViewer *viewer, bool isHit, bool complex){
#ifdef HAVE_GL_H
  bool olddepthtest=!!glIsEnabled(GL_DEPTH_TEST);
  if(options & VERTICES_NODEPTHTEST) glDisable(GL_DEPTH_TEST);
  if(!displayLists) displayLists=glGenLists(3);
  if(modified & (1<<viewer->doesTurbo())){
    //fxmessage("modified=%u\n", modified);
    if(complex){
      // Render a sphere into a display list as it's the same for all points
      GLUquadricObj* quad=0;
      glNewList(displayLists+2, GL_COMPILE);
      quad=gluNewQuadric();
      gluQuadricDrawStyle(quad,(GLenum)GLU_FILL);
      gluSphere(quad,pointSize/2,12,12);
      gluDeleteQuadric(quad);
      glEndList();
      }
    glNewList(displayLists+viewer->doesTurbo(), GL_COMPILE);
    if(vertexNumber){
      if(complex){
        if(options & VERTICES_POINTS)
          renderPoints(viewer, isHit, complex);
        if(options & VERTICES_LINES)
          renderLines(viewer, isHit, complex);
        }
      else{
        if(options & VERTICES_POINTS){
          if(!isHit) glPointSize(pointSize);
          glBegin(GL_POINTS);
          renderPoints(viewer, isHit, complex);
          glEnd();
        }
        if(options & VERTICES_LINES){
          if(!isHit) glLineWidth(lineSize);
          glBegin((options & VERTICES_LOOPLINES) ? GL_LINE_LOOP : (options & VERTICES_LINEITEMS) ? GL_LINES : GL_LINE_STRIP);
          renderLines(viewer, isHit, complex);
          glEnd();
          }
        }
      }
    glEndList();
    modified&=~(1<<viewer->doesTurbo());
    }
  glCallList(displayLists+viewer->doesTurbo());
  if((options & VERTICES_NODEPTHTEST) && olddepthtest) glEnable(GL_DEPTH_TEST);
#endif
  }
void RenderableTrailNew::render(const RenderData& data) {
    _programObject->activate();
    if (_renderFullTrail.value() == true) {
        preRender(_vertexPositionArray.size());
        preRenderSubPathGlobally(data);
        // Easy but not beautiful solution to render all vertices with max alpha
        _programObject->setUniform(
            "vertexIDPadding", static_cast<int>(_vertexPositionArray.size()));

        renderLines(_vaoGlobalID, _vertexPositionArray.size() - 1);
        if (_showTimeStamps) {
            renderPoints(_vaoGlobalID, _vertexPositionArray.size() - 1);
        }
    }
    else { // Only render the trail up to the point of the object body
        int nVerticesToDraw = glm::ceil(_vertexPositionArray.size() *
            (_currentTimeClamped - _timeRange.start) / (_timeRange.end - _timeRange.start));

        nVerticesToDraw = glm::min(
            nVerticesToDraw, static_cast<int>(_vertexPositionArray.size())) - 1;
        if (nVerticesToDraw > 1) {
            preRender(nVerticesToDraw);
            // Perform rendering of the bulk of the trail in single floating point precision
            preRenderSubPathGlobally(data);
            // The last vertex is drawn with higher precision after this
            // Hence we subtract one vertex from the ones to draw globally
            int nVerticesToDrawGlobally = nVerticesToDraw - 1;
            renderLines(_vaoGlobalID, nVerticesToDrawGlobally);
            if (_showTimeStamps) {
                renderPoints(_vaoGlobalID, nVerticesToDrawGlobally);
            }

            // The last line segment is rendered relative to body to achieve high precision
            preRenderSubPathLocally(data, nVerticesToDraw);
            renderLines(_vaoLocalID, 2);
            if (_showTimeStamps) {
                renderPoints(_vaoLocalID, 2);
            }
        }
        else if (_currentTimeClamped > _timeRange.start) {
            preRenderSubPathLocally(data, 2);
            renderLines(_vaoLocalID, 2);
        }
    }
    _programObject->deactivate();
}
void ScrollingTextRenderer::render(GameWindow& window, float percBehind)
{
	if (needToScroll())
	{
		scroll();
		timeSinceLastScroll_ = 0;
	}
	else
	{
		timeSinceLastScroll_ += Time::getElapsedUpdateTimeSeconds();
	}
	renderLines(window, percBehind);
}
void TNMParallelCoordinates::process() {
	if (!_inport.hasData())
		return;

	// If the underlying data has changed, we need to extract the names of the data values
	// and make them available in the combobox for the coloring options
	if (_inport.hasChanged()) {
        _colorMethod.setOptions(std::vector<Option<int> >());
		for (size_t i = 0; i < _inport.getData()->valueNames.size(); ++i) {
			std::stringstream s;
			s << i;
			_colorMethod.addOption(s.str(), _inport.getData()->valueNames[i], i);
			s.str("");
		}
		_colorMethod.updateWidgets();
	}

	// Activate the user-outport as the rendering target
    _outport.activateTarget();
	// Clear the buffer
    _outport.clearTarget();

	// Render the handles
    renderHandles();
	// Render the parallel coordinates lines
    renderLines();
	// Render text
	renderText();

	// We are done with the visual part
    _outport.deactivateTarget();

	// Activate the internal port used for picking
    _privatePort.activateTarget();
	// Clear that buffer as well
    _privatePort.clearTarget();
	// Render the handles with the picking information encoded in the red channel
    renderHandlesPicking();
	// Render the lines with the picking information encoded in the green/blue/alpha channel
	renderLinesPicking();
	// We are done with the private render target
    _privatePort.deactivateTarget();
}
		std::string
		PostscriptRenderer::render (
		const boost::filesystem::path& tempDir,
		const std::string& filenamePrefix,
		const Registry<JourneyPattern>& lines,
		synthese::map::Map& map,
		const synthese::map::RenderingConfig& config
		)		{

			std::string resultFilename = filenamePrefix + ".ps";
			const boost::filesystem::path psFile (tempDir / resultFilename);

			// Create the postscript canvas for output
			std::ofstream of (psFile.string ().c_str ());

			// Filter accents (temporary workaround til having found how to
			// render accents properly in ghostscript.

			// boost::iostreams::filtering_ostream fof;
			// fof.push (synthese::util::PlainCharFilter());
			// fof.push (of);

			// ---- Render postscript file ----
			PostscriptCanvas _canvas(of);

			_config = config;

			_canvas.startPage(0, 0, map.getWidth (), map.getHeight ());

			renderBackground (_canvas, map);
			renderLines (_canvas, map);
			renderPhysicalStops (_canvas, map);

			_canvas.showPage();

			of.close ();

			return resultFilename;

		}
Example #9
0
void asciimage::Shape::renderPolygon(QPainter* painter, int scale, const Style& style) const
{
    Q_ASSERT(type() == Type::POLYGON);

    if (!style.isClosed())
    {
        renderLines(painter, scale, style);
        return;
    }

    Q_ASSERT(points().size() >= 3);

    if (isRectangle() && style.isFilled())
    {
        const QRect b = boundingRect();
        painter->setPen(style.color());
        painter->setBrush(style.color());
        painter->drawRect(scaledOuterRect(b, scale));
    }
    else
    {
        QPolygonF poly;
        for (const QPoint& point : points())
        {
            poly << p(point, scale);
        }
        poly << p(points().first(), scale);

        painter->setRenderHint(QPainter::Antialiasing, true);
        painter->setPen(QPen(style.color(), scale, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin));
        if (style.isFilled())
        {
            painter->setBrush(style.color());
        }
        painter->drawPolygon(poly);
    }
}