Exemple #1
0
void
NetworkObject::drawNetwork(float pnear, float pfar,
			   bool backToFront)
{
  if (backToFront)
    {
      if (m_Eopacity > 0.01) drawEdges(pnear, pfar);
      if (m_Vopacity > 0.01) drawVertices(pnear, pfar);
    }
  else
    {
      if (m_Vopacity > 0.01) drawVertices(pnear, pfar);
      if (m_Eopacity > 0.01) drawEdges(pnear, pfar);
    }
}
QPainterPath Draw_Line::getPolyLine()
{
  QPainterPath polygon;
    if(!poly_pnts.isEmpty())
    {

        polygon.addPolygon(QPolygonF(poly_pnts));
        drawEdges();

        QBrush rectbrush;
        rectbrush.setColor(QColor(0,175,225));
        rectbrush.setStyle(Qt::SolidPattern);

        QPointF pnt1,pnt2;

        pnt1.setX(((polygon.boundingRect().topLeft().x()+polygon.boundingRect().bottomRight().x())/2)-5);
        pnt1.setY(polygon.boundingRect().topLeft().y()-20);

        pnt2.setX(((polygon.boundingRect().topLeft().x()+polygon.boundingRect().bottomRight().x())/2)+5);
        pnt2.setY(polygon.boundingRect().topLeft().y()-10);

        Rot_Rect = new QGraphicsEllipseItem(QRectF(pnt1,pnt2));
        Rot_Rect->setBrush(rectbrush);

        return polygon;
    }

  return polygon;
}
Exemple #3
0
void AsciiTree::draw() {
    if (root == NULL) return;

    assignX();
    getOffset();

    vector<AsciiNode *> levelNodes;
    queue<AsciiNode *> fifo;
    int nextLevel = root->level;

    fifo.push(root);
    while (!fifo.empty()) {
        while (!fifo.empty() && fifo.front()->level == nextLevel) {
            AsciiNode *current = fifo.front();
            levelNodes.push_back(current);
            if (current->left)  {
                current->left->level = current->level + 1;
                fifo.push(current->left);
            }
            if (current->right) {
                current->right->level = current->level + 1;
                fifo.push(current->right);
            }
            fifo.pop();
        }

        if (!fifo.empty())
            nextLevel = fifo.front()->level;

        drawLevel(levelNodes);
        drawEdges(levelNodes);
        levelNodes.clear();
    }
}
Exemple #4
0
void Viewer::draw_one_vol(Dart_const_handle adart, bool filled)
{
    LCC &m = *scene->lcc;

    if ( filled )
    {
        for (LCC::One_dart_per_incident_cell_range<2,3>::const_iterator it(m,adart);
                it.cont(); ++it)
        {
            drawFacet(it);
            if (edges) drawEdges(it);
        }
    }
    else
    {
        glBegin(GL_LINES);
        glColor3f(.2f,.2f,.6f);
        for (LCC::One_dart_per_incident_cell_range<1,3>::const_iterator
                it(m,adart); it.cont(); ++it)
        {
            if ( it->other_extremity()!=NULL )
            {
                LCC::Point p1 = m.point(it);
                LCC::Point p2 = m.point(it->other_extremity());
                glVertex3f( p1.x(),p1.y(),p1.z());
                glVertex3f( p2.x(),p2.y(),p2.z());
            }
        }
        glEnd();
    }
}
void mainMenu::displayGameOver() {
	ofBackground(92,1,106);
	ofSetColor(0);
	ofFill();
	ofRect(100,90,400,220);
	drawEdges();
	hover();
}
void COverlappedWindow::drawGame(HDC paintDC, const RECT& rect) {
	drawBackground(paintDC, rect);
	drawGrid(paintDC, rect);
	if (!isCustomGameSettings) {
		drawPoints(paintDC, rect);
		drawScoreboard(paintDC, rect);
		drawEdges(paintDC, rect);
	}
}
Exemple #7
0
void GraphDrawer::draw()
{
    startDrawing();
    drawEdges();
    drawHighlightEdges();
    drawNodes();
    drawLabels();
    clearChanged();
}
void mainMenu::displayYouWin() {
	cout<<"MouseX: "<<ofGetMouseX()<<endl<<"MouseY: "<<ofGetMouseY(); 
	ofBackground(30,255,0);
	ofSetColor(0);
	ofFill();
	ofRect(100,90,400,220);
	drawEdges();
	hoverWin();
}
Exemple #9
0
void drawMeshWireframe(carve::mesh::Mesh<3> *mesh, bool draw_normal, bool draw_edgeconn) {
  if (draw_normal) {
    for (size_t i = 0, l = mesh->faces.size(); i != l; ++i) {
      carve::mesh::Face<3> *f = mesh->faces[i];
      drawFaceNormal(f);
    }
  }

  glDisable(GL_LIGHTING);
  glDepthMask(GL_FALSE);
  glDisable(GL_DEPTH_TEST);

  drawEdges(mesh, 0.2, draw_edgeconn);

  glEnable(GL_DEPTH_TEST);

  drawEdges(mesh, 0.8, draw_edgeconn);

  glDepthMask(GL_TRUE);
  glEnable(GL_LIGHTING);
}
void Mesh :: drawOpenGL()
{ 
  tellMaterialsGL(); 	
  glPushMatrix();
  glMultMatrixf(transf.m);

  switch (mode) {
  case MODE_WIRE:
    drawEdges();
    break;
  case MODE_SOLID:
    drawFaces();	
    break;
  default:
    drawFaces();	
    drawEdges();
    break;
  }

  glPopMatrix();
} 
void ThumbSlider::paintEvent(QPaintEvent *event)
{
	QPainter painter;

	painter.begin(this);
	painter.setClipRect(event->rect());
	painter.setPen(Qt::NoPen);

	drawBackground(&painter);
	drawLines(&painter);
	drawBorders(&painter);
	drawEdges(&painter);
}
Exemple #12
0
void Mesh::drawOpenGL()
{
	tellMaterialsGL();
	glPushMatrix();
	if (usesTexture)
	{
		if (!textureLoaded)
		{
			cout << " \n TextureFileName = " << texturefile << endl;
		setTexture(loadTexture(texturefile));
		}
			
		glBindTexture(GL_TEXTURE_2D, texture);
		glEnable(GL_TEXTURE_2D);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
	}
	glMultMatrixf(transf.m);
	switch (mode) {
	case MODE_WIRE:
		drawEdges();
		break;
	case MODE_SOLID:
		drawFaces();
		break;
	default:
		drawFaces();
		drawEdges();
		break;
	}
	
	glPopMatrix();
}
Exemple #13
0
void displayMST(Graph &graph, Map<coordT> &m) {
	Vector<Arc *> MST = graph.findMST();
	double netLength = 0;
	for (int i = 0; i < MST.size(); i++) {
		Arc *arc = MST[i];
		netLength += arc->cost;
		DrawLineBetween(m[arc->start->name], m[arc->finish->name], "Red");
	//  Pause(0.05);
	}
	cout << endl << "MST now displayed." << endl
		<< "Total network length is " << netLength << " miles." << endl
		<< "Hit return to continue: ";
	GetLine();
	drawEdges(graph, m);
}
Exemple #14
0
/* function that draws window with all stuff */
void draw(void)
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glLoadIdentity();
  /* draw working window and panel with set of tools */
  drawGrid();
  drawPanel(mapState.border);
  glColor3f(0, 0, 0);
  drawBitmapText("Tools", BITMAPTEXT_X, BITMAPTEXT_Y);
  drawButtons();
  passiveLineMotion(mapState.points_storage, mapState.previous_point, mapState.passive_motion_point);
  drawEdgeVertices(mapState.points_storage, RADIUS_OF_POINT);
  drawEdges(mapState.edges_storage);
  checkSelectedPoint(mapState.points_storage, mapState.passive_motion_point);
  markSelectedPoint(mapState.previous_point, mapState.selected_point, SIZE_OF_SHINING_CIRCLE);
  glutSwapBuffers();
  glFlush();
}
Exemple #15
0
void testApp::draw()
{
    drawEdges();


    std::vector< ofPtr<Polygon> >::iterator it = polygons.begin();

    for( ; it != polygons.end(); ++it ){
        if( it == currentPolygon ){
            if( (*it)->drawableByRobot() ){
                ofSetColor( ofColor::white );
            }else{
                ofSetColor( ofColor::red );
            }
        }else{
            if( (*it)->drawableByRobot() ){
                ofSetColor( 150, 150, 150 );
            }else{
                ofSetColor( 150, 0, 0 );
            }
        }
        (*it)->draw();
        ofSetColor( ofColor::white );
    }

    tempPolygon->draw();
    Vertex origin = Polygon::getOrigin();

    //Vertex currentMouseWorldPos( currentMousePos[X]-origin[X], -currentMousePos[Y]+origin[Y]  );
    Vertex currentMouseWorldPos( lastMouseX-origin[X], -lastMouseY+origin[Y]  );

    if( (appMode == MODE_POLYGON_CREATION) && tempPolygon->getSize() ){
        Polygon::drawLine( tempPolygon->getLastVertex(), currentMouseWorldPos );
    }

    if( ( appMode == MODE_FRACTAL_CREATION ) && (fractalCurrentRefVertex == 1) ){
        Polygon::drawLine( fractalRefVertexes[0],
                           currentMouseWorldPos );
    }

    server->drawBrick();
}
Exemple #16
0
void VDGridTest::drawGraph(GeoDrawer * dr)
{
#define SHO_NODE 0
#define SHO_EDGE 0
#define SHO_ERR 1

#if SHO_NODE	
	drawNodes(&m_msh, dr);
#endif

#if SHO_EDGE	
	dr->setColor(0.f, 0.f, .5f);	
	drawEdges(&m_msh, dr);
#endif

#if SHO_ERR
	drawErrors(&m_msh, m_msh.dirtyEdges(), m_msh.errorThreshold() );
#endif

}
Exemple #17
0
void SystemMesh::draw( OpenGLPtr openGL, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix, const glm::vec4 *contourColor ) const
{
    openGL->setShadingMode( ShadingMode::SOLID_LIGHTING );
    sendToShader( *openGL, viewMatrix, projectionMatrix );
    sendMaterialToShader( 0 );

    for( const TrianglesGroupWithTextureWall& trianglesGroup : trianglesGroups_ ){
        if( textureWallsManager_->textureWallIncludesTexture( trianglesGroup.textureWallID ) ){
            openGL->setShadingMode( ShadingMode::SOLID_LIGHTING_AND_TEXTURING );
            textureWallsManager_->sendTextureWallToShader( trianglesGroup.textureWallID );
        }else{
            openGL->setShadingMode( ShadingMode::SOLID_LIGHTING );
        }

        drawTriangles( trianglesGroup.firstTriangleIndex, trianglesGroup.nTriangles );
    }

    drawEdges( openGL, viewMatrix, projectionMatrix, contourColor );

    if( displaysVertexNormals() ){
        drawVertexNormals( openGL, viewMatrix, projectionMatrix, glm::vec4( 1.0f, 0.0f, 0.0f, 0.0f )  );
    }
}
Exemple #18
0
void Viewer::cb_redraw()
{
	// Draw the faces with SSAO and everything else
	if (m_useSSAO && m_drawFaces)
	{
		CGoGNGLuint SSAOTexture = computeSSAO();
		
		// Get and draw only SSAO results
		if (m_displayOnlySSAO)
			Utils::TextureSticker::StickTextureOnWholeScreen(SSAOTexture);
		// Use SSAO results with regular rendering
		else
		{
			// Render color and depth
			m_finalRenderFbo->Bind();
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
			{
				// Simply render faces color and depth
				drawFaces();
			}
			m_finalRenderFbo->Unbind();
		
			// Merge color and SSAO
			m_colorAndSSAOMergeFbo->Bind();
			glClear(GL_COLOR_BUFFER_BIT);
			{
				// Send textures to multiply shader
				m_multTexturesShader->bind();
				m_multTexturesShader->setTexture1Unit(GL_TEXTURE0);
				m_multTexturesShader->activeTexture1(m_finalRenderFbo->GetColorTexId(0));
				m_multTexturesShader->setTexture2Unit(GL_TEXTURE1);
				m_multTexturesShader->activeTexture2(SSAOTexture);
				m_multTexturesShader->unbind();
			
				// Multiply textures together
				Utils::TextureSticker::DrawFullscreenQuadWithShader(m_multTexturesShader);
			}
			m_colorAndSSAOMergeFbo->Unbind();
			
			// Get and draw color texture from merged SSAO and color Fbo into final render Fbo (we need to use the depth information to display everything else)
			m_finalRenderFbo->Bind();
			glClear(GL_COLOR_BUFFER_BIT);
			{
				// Simply stick result texture on screen
				Utils::TextureSticker::StickTextureOnWholeScreen(m_colorAndSSAOMergeFbo->GetColorTexId(0));
				
				// Now that we have depth *and* SSAO information, display everything else
				if(m_drawVertices)
					drawVertices();
				if(m_drawEdges)
					drawEdges();
				if(m_drawTopo)
					drawTopo();
				if(m_drawNormals)
					drawNormals();
			}
			m_finalRenderFbo->Unbind();
			
			// Stick final render in main framebuffer
			Utils::TextureSticker::StickTextureOnWholeScreen(m_finalRenderFbo->GetColorTexId(0));
		}
	}
	// Draw everything without SSAO
	else
	{
		if (m_drawFaces)
			drawFaces();
		if(m_drawVertices)
			drawVertices();
		if(m_drawEdges)
			drawEdges();
		if(m_drawTopo)
			drawTopo();
		if(m_drawNormals)
			drawNormals();
	}
	
	// Check for OpenGL errors
	GLenum glError = glGetError();
	if (glError != GL_NO_ERROR)
		std::cout << "GL error : " << gluErrorString(glError) << std::endl;
}
Exemple #19
0
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
JNIEXPORT void JNICALL Java_com_qualcomm_fastcvdemo_apis_imageProcessing_Filter_update
(
   JNIEnv*     env,
   jobject     obj,
   jbyteArray  img,
   jint        w,
   jint        h
)
{
   jbyte*            jimgData = NULL;
   jboolean          isCopy = 0;
   uint32_t*         curCornerPtr = 0;
   uint8_t*          renderBuffer;
   uint64_t          time;
   float             timeMs;

   // Allocate the buffer once here if it's not allocated already
   if( filterState.filteredImgBuf == NULL)
   {
      int frameSize = w*h*3/2;
      filterState.filteredImgBuf = (uint8_t *)fcvMemAlloc(frameSize, 16);
      if( filterState.filteredImgBuf == NULL )
      {
         EPRINTF("Allocate filteredImgBuf failed");
      }
      else
      {
         memset(filterState.filteredImgBuf, 128, frameSize);
      }
   }

   // Get data from JNI
   jimgData = env->GetByteArrayElements( img, &isCopy );

   renderBuffer = getRenderBuffer( w, h );

   lockRenderBuffer();

   time = util.getTimeMicroSeconds();

   // jimgData might not be 128 bit aligned.
   // fcvColorYUV420toRGB565u8() and other fcv functionality inside
   // require 128 bit memory aligned. In case of jimgData
   // is not 128 bit aligned, it will allocate memory that is 128 bit
   // aligned and copies jimgData to the aligned memory.

   uint8_t* pJimgData    = (uint8_t*)jimgData;
   uint8_t* pFilteringData = (uint8_t*)filterState.filteredImgBuf;

   // Check if camera image data is not aligned.
   if( (int)jimgData & 0xF )
   {
      // Allow for rescale if dimensions changed.
      if( w != (int)filterState.imgWidth ||
          h != (int)filterState.imgHeight )
      {
         if( filterState.alignedImgBuf != NULL )
         {
            DPRINTF( "%s %d Creating aligned for preview\n",
               __FILE__, __LINE__ );
            fcvMemFree( filterState.alignedImgBuf );
            filterState.alignedImgBuf = NULL;
         }
      }

      // Allocate buffer for aligned data if necessary.
      if( filterState.alignedImgBuf == NULL )
      {
    	  filterState.imgWidth = w;
    	  filterState.imgHeight = h;
    	  filterState.alignedImgBuf = (uint8_t*)fcvMemAlloc( w*h*3/2, 16 );
      }

      memcpy( filterState.alignedImgBuf, jimgData, w*h*3/2 );
      pJimgData = filterState.alignedImgBuf;
	}

   else if( w != (int)filterState.imgWidth ||
				h != (int)filterState.imgHeight )
   {
	   filterState.imgWidth = w;
	   filterState.imgHeight = h;
   }

   // Perform FastCV Function processing
   updateFilter( (uint8_t*)pJimgData, w, h, (uint8_t*)pFilteringData );

   // Copy the image first in our own buffer to avoid corruption during
   // rendering. Not that we can still have corruption in image while we do
   // copy but we can't help that.

   colorConvertYUV420ToRGB565Renderer(pFilteringData,
                            w,
                            h,
                            (uint32_t*)renderBuffer );

   // Update image
   timeMs = ( util.getTimeMicroSeconds() - time ) / 1000.f;
   util.setProcessTime((util.getProcessTime()*(29.f/30.f))+(float)(timeMs/30.f));

   if( filterState.filterType == ENABLE_CANNY )
   {
	   drawEdges(filterState.edgeImgBuf, filterState.edgeImgHeight, filterState.edgeImgWidth);
   }

   unlockRenderBuffer();

   // Let JNI know we don't need data anymore
   env->ReleaseByteArrayElements( img, jimgData, JNI_ABORT );
}
void mainMenu::displayGameStart() {
	ofSetColor(0);
	ofFill();
	ofRect(100,90,400,220);
	drawEdges();
}
      static void walkGraphSegment(carve::csg::detail::VVSMap &shared_edge_graph,
                                   const carve::csg::detail::VSet &branch_points,
                                   V2 initial,
                                   const carve::csg::detail::LoopEdges & /* a_edge_map */,
                                   const carve::csg::detail::LoopEdges & /* b_edge_map */,
                                   std::list<V2> &out) {
        V2 curr;
        curr = initial;
        bool closed = false;

        out.clear();
        for (;;) {
          // walk forward.
          out.push_back(curr);
          remove(curr, shared_edge_graph);

          if (curr.second == initial.first) { closed = true; break; }
          if (branch_points.find(curr.second) != branch_points.end()) break;
          carve::csg::detail::VVSMap::const_iterator o = shared_edge_graph.find(curr.second);
          if (o == shared_edge_graph.end()) break;
          CARVE_ASSERT((*o).second.size() == 1);
          curr.first = curr.second;
          curr.second = *((*o).second.begin());
          // test here that the set of incident groups hasn't changed.
        }

        if (!closed) {
          // walk backward.
          curr = initial;
          for (;;) {
            if (branch_points.find(curr.first) != branch_points.end()) break;
            carve::csg::detail::VVSMap::const_iterator o = shared_edge_graph.find(curr.first);
            if (o == shared_edge_graph.end()) break;
            curr.second = curr.first;
            curr.first = *((*o).second.begin());
            // test here that the set of incident groups hasn't changed.

            out.push_front(curr);
            remove(curr, shared_edge_graph);
          }
        }

#if defined(CARVE_DEBUG)
        std::cerr << "intersection segment: " << out.size() << " edges." << std::endl;
#if defined(DEBUG_DRAW_INTERSECTION_LINE)
        {
          static float H = 0.0, S = 1.0, V = 1.0;
          float r, g, b;

          H = fmod((H + .37), 1.0);
          S = 0.5 + fmod((S - 0.37), 0.5);
          carve::colour::HSV2RGB(H, S, V, r, g, b);

          if (out.size() > 1) {
            drawEdges(out.begin(), ++out.begin(),
                      0.0, 0.0, 0.0, 1.0,
                      r, g, b, 1.0,
                      3.0);
            drawEdges(++out.begin(), --out.end(),
                      r, g, b, 1.0,
                      r, g, b, 1.0,
                      3.0);
            drawEdges(--out.end(), out.end(),
                      r, g, b, 1.0,
                      1.0, 1.0, 1.0, 1.0,
                      3.0);
          } else {
            drawEdges(out.begin(), out.end(),
                      r, g, b, 1.0,
                      r, g, b, 1.0,
                      3.0);
          }
        }
#endif
#endif
      }
Exemple #22
0
void gameStates::displayGameOver() {
	ofSetColor(0);
	ofFill();
	ofRect(100,90,400,220);
	drawEdges();
}
Exemple #23
0
void drawMap(Graph &graph, Map<coordT> &m) {
	drawVertices(m);
	drawEdges(graph, m);
}
void
PoseGraphViz::visualizeEdges(const std::string& marker_ns)
{
    visualization_msgs::Marker marker;

    marker.header.frame_id = "vmav";
    marker.header.stamp = ros::Time::now();

    marker.ns = marker_ns;
    marker.id = 0;

    marker.type = visualization_msgs::Marker::LINE_LIST;

    marker.action = visualization_msgs::Marker::ADD;

    marker.pose.position.x = 0;
    marker.pose.position.y = 0;
    marker.pose.position.z = 0;
    marker.pose.orientation.x = 0.0;
    marker.pose.orientation.y = 0.0;
    marker.pose.orientation.z = 0.0;
    marker.pose.orientation.w = 1.0;

    marker.scale.x = 0.02;
    marker.scale.y = 0.0;
    marker.scale.z = 0.0;

    marker.color.r = 0.0f;
    marker.color.g = 1.0f;
    marker.color.b = 0.0f;
    marker.color.a = 1.0;

    marker.lifetime = ros::Duration();

    std_msgs::ColorRGBA cRed; // this color marks wrong loop closure edges
    std_msgs::ColorRGBA cGreen; // this color marks correct loop closure edges
    std_msgs::ColorRGBA cBlue; // this color marks VO edges

    cRed.r = 1.0f;
    cRed.g = 0.0f;
    cRed.b = 0.0f;

    cGreen.r = 0.0f;
    cGreen.g = 1.0f;
    cGreen.b = 0.0f;

    cBlue.r = 0.0f;
    cBlue.g = 0.0f;
    cBlue.b = 1.0f;

    // Draw correct loop closure edges.
    std::vector<std::pair<PoseConstWPtr, PoseConstWPtr> > cLoopClosureEdges =
        k_poseGraph->getLoopClosureEdges(true);

    drawEdges(cLoopClosureEdges, cGreen, marker);

    // Draw wrong loop closure edges.
    std::vector<std::pair<PoseConstWPtr, PoseConstWPtr> > wLoopClosureEdges =
        k_poseGraph->getLoopClosureEdges(false);

    drawEdges(wLoopClosureEdges, cRed, marker);

    // Draw VO edges.
    std::vector<std::pair<PoseConstWPtr, PoseConstWPtr> > voEdges =
        k_poseGraph->getVOEdges();

    drawEdges(voEdges, cBlue, marker);

    m_edgeVizPub.publish(marker);
}
Exemple #25
0
void GraphView::drawModel(sf::RenderWindow &rw)
{
	drawEdges(rw);
	drawCircles(rw);
}
Exemple #26
0
void reflection(){

    glPushMatrix();
        //glRotatef(-90,1,0,0);
        quad(2,1,1,0);
    glPopMatrix();

    //REFLEXÃO 
    //1. Activa o uso do stencil buffer
    glEnable(GL_STENCIL_TEST);
    //2. Nao escreve no color buffer - desativar
    glColorMask(GL_FALSE, GL_FALSE,GL_FALSE, GL_FALSE);
    //3. Torna inactivo o teste de profundidade                                                 
    glDisable(GL_DEPTH_TEST);
    //4. Coloca a 1 todos os pixels no stencil buffer que representam o chão. A combinaçao desenhaChao + StencilFunc + StencilOp e que me da a mascara. A area de desenho, que vai ser colocada  1, e dada pelo desenhaChao.
    glStencilFunc(GL_ALWAYS, 1, 1);
    glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
    //5. Desenhar o quadrado
    drawEdges();
    //6. Activa a escrita de cor                                                                
    glColorMask(1, 1, 1, 1);
    //7. Activa o teste de profundidade                                                         
    glEnable(GL_DEPTH_TEST);
    //8. O stencil test passa apenas quando o pixel tem o valor 1 no stencil buffer             
    glStencilFunc(GL_EQUAL, 1, 1);
    //9. Stencil buffer read-only
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
    //10. Desenha o objecto com a reflexão onde stencil buffer é 1
    
    //para z=0 e z=10
    glPushMatrix();
        glTranslatef(0, 0, -0.001);
        glRotatef(-90,1,0,0);
        glScalef(1,-1,1);
        quad(2,1,1,1);
    glPopMatrix();

    glPushMatrix();
        glTranslatef(0, 2, 10.001);
        glRotatef(90,1,0,0);
        
        glScalef(1,-1,1);
        quad(2,1,1,1);
    glPopMatrix();
    //----------------------------
    
    //para x=0 e x=10
    glPushMatrix();
        glTranslatef(-0.001, 0,0);
        glRotatef(90,0,0,1);
        glScalef(1,-1,1);
        quad(2,1,1,2);
    glPopMatrix();

    glPushMatrix();
        glTranslatef(10.001, 2,0);
        glRotatef(270,0,0,1);
        glScalef(1,-1,1);
        quad(2,1,1,2);
    glPopMatrix();

    
    //11. Desactiva a utilização do stencil buffer
    glDisable(GL_STENCIL_TEST);
    // isto aplica a textura ao chao Blending
    glEnable(GL_BLEND);
    glColor4f(1, 1, 1, 0.3);
    drawEdges();
    glDisable(GL_BLEND);
}