Exemplo n.º 1
0
void render()
{ 
  glutSetWindow(1);
  //Clear color buffer
  glClear( GL_COLOR_BUFFER_BIT );

  //Reset modelview matrix
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
  

  
  glLineWidth(1.0) ; 
  if(Animal1.enfermo){
    glColor3f( 0.75f, 0.1f, 0.1f );
  }else{
    glColor3f( 0.55f, 0.2f, 0.3f );
  }

  DrawDisk(c1x, c1y, r1, 5);

  
  for(int i=0; i<animales; i++){
    glLineWidth(1.0) ;
    if(Animal2[i].enfermo){
      glColor3f( 0.75f, 0.1f, 0.1f );
    }else{
      glColor3f( 0.55f, 0.2f, 0.3f );
  }

    DrawDisk(c2x[i], c2y[i], r1, 5);
  };
   
 
  if( trazo ){
    glColor3f( 0.0f, 0.9f, 0.0f );
    glLineWidth(2.0) ;
    glBegin(GL_LINES);    
    for(int i=1; i<trazounox.size();i++){
      glVertex2f(trazounox[i-1], trazounoy[i-1]);//output vertex           
      glVertex2f(trazounox[i], trazounoy[i]);//output vertex           
    };
    glEnd();
    
  };


  
  //Update screen 1
  glutSwapBuffers();
  
};
void render()
{ 
  glutSetWindow(1);
  //Clear color buffer
  glClear( GL_COLOR_BUFFER_BIT );

  //Reset modelview matrix
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
  

  glLineWidth(1.0) ; 


  //dibujamos el SOL
  glLineWidth(1.0) ;
  glColor3f( 0.77f, 0.12f, 0.12f );
  DrawDisk(0, 0, 10, 50);

  float r2=1;

  glColor3f( 0.3f, 0.12f, 0.6f );
  DrawDisk(Tierra.q(0), Tierra.q(1), r2, 50);


 
  if( trazo ){
    glColor4f( 0.1f, 0.8f, 0.1f, 0.1f );
    glLineWidth(2.0) ;
    glBegin(GL_LINES);    
    for(int i=1; i<trazounox.size();i++){
      glVertex2f(trazounox[i-1], trazounoy[i-1]);//output vertex           
      glVertex2f(trazounox[i], trazounoy[i]);//output vertex           
    };
    glEnd();
    
  };


  
  //Update screen 1
  glutSwapBuffers();
  
};
Exemplo n.º 3
0
void render()
{ 
  glutSetWindow(1);
  //Clear color buffer
  glClear( GL_COLOR_BUFFER_BIT );

  //Reset modelview matrix
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
  
  //Render the quad
  

  
  
  /* Tell OpenGL your intentions */
  // glColor3f( 0.1f, 0.1f, 0.1f );
  //glBegin(GL_POLYGON);
  /* Set the vertices */
  //glVertex2d(-widthmedia, heightmedia);
  //glVertex2d(-widthmedia, -heightmedia);
  //glVertex2d(widthmedia, -heightmedia);
  //glVertex2d(widthmedia, heightmedia);
  /* Done making polygon */
  //glEnd(); 
  
  glLineWidth(1.0) ;
  glColor3f( 0.45f, 0.3f, 0.1f );
  DrawDisk(c1x, c1y, r1, 50);

   
 
  if( trazo ){
    glColor3f( 0.9f, 0.9f, 0.3f );
    glLineWidth(2.0) ;
    glBegin(GL_LINES);    
    for(int i=1; i<trazounox.size();i++){
      glVertex2f(trazounox[i-1], trazounoy[i-1]);//output vertex           
      glVertex2f(trazounox[i], trazounoy[i]);//output vertex           
    };
    glEnd();
    
  };


  
  //Update screen 1
  glutSwapBuffers();
  
};
Exemplo n.º 4
0
void 
DrawDooDads(void)
{
  int i;
  stack_node *temp;
  int xcenter, ycenter;
  glColor3fv(diskColor);
  glMaterialfv(GL_FRONT, GL_DIFFUSE, diskColor);
  for (i = 1; i <= 3; i++) {
    xcenter = i * WIDTH / 4;
    for (temp = poles[i].head, ycenter = DISK_HEIGHT * poles[i].depth - DISK_HEIGHT / 2; temp; temp = temp->next, ycenter -= DISK_HEIGHT) {
      DrawDisk(xcenter, ycenter, temp->size);
    }
  }
}
Exemplo n.º 5
0
void render()
{ 
  glutSetWindow(1);
  //Clear color buffer
  glClear( GL_COLOR_BUFFER_BIT );

  //Reset modelview matrix
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
  

  glLineWidth(1.0) ; 

  if(cuadrados){
   
    for(int i=0; i<animalgridsize*animalgridsize; i++){
      float azules;
      azules=(float)i/(animalgridsize*animalgridsize)*0.999;
      glColor3f( 0.2f, 0.0f+azules, 0.2f );  
      glBegin(GL_LINE_LOOP);    
      glVertex2f(-0.5+Centro2x[i], -0.5+Centro2y[i]);//output vertex 
      glVertex2f(0.5+Centro2x[i], -0.5+Centro2y[i]);
      glVertex2f(0.5+Centro2x[i], 0.5+Centro2y[i]);
      glVertex2f(-0.5+Centro2x[i], 0.5+Centro2y[i]);
      glEnd();
      if(Animal2[i].enfermo){
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
	glColor4f( 0.8f, 0.0f, 0.0f, 0.5f );  	
	
	//Territorio enfermo
	glBegin(GL_TRIANGLE_FAN); 
	glVertex2f(-0.5+Centro2x[i], -0.5+Centro2y[i]);//output vertex 
	glVertex2f(0.5+Centro2x[i], -0.5+Centro2y[i]);
	glVertex2f(0.5+Centro2x[i], 0.5+Centro2y[i]);
	glVertex2f(-0.5+Centro2x[i], 0.5+Centro2y[i]);
	glEnd();
      }

    }
  } 

  
  for(int i=0; i<animalgridsize*animalgridsize; i++){
    glLineWidth(1.0) ;
    if(Animal2[i].enfermo){
      glColor3f( 0.75f, 0.1f, 0.1f );
    }else{
      glColor3f( 0.55f, 0.2f, 0.3f );
    }
    DrawDisk(c2x[i], c2y[i], r1, 15);
  };
  


  //Territorio del animal enfermo original
  glColor3f( 0.6f, 0.0f, 0.1f );  
  glBegin(GL_LINE_LOOP);    
  glVertex2f(-0.5+Centro2x[animalespecial], -0.5+Centro2y[animalespecial]);
  glVertex2f(0.5+Centro2x[animalespecial], -0.5+Centro2y[animalespecial]);
  glVertex2f(0.5+Centro2x[animalespecial], 0.5+Centro2y[animalespecial]);
  glVertex2f(-0.5+Centro2x[animalespecial], 0.5+Centro2y[animalespecial]);
  glEnd();

  if( trazo ){
    glColor4f( 0.1f, 0.8f, 0.1f, 0.1f );
    glLineWidth(2.0) ;
    glBegin(GL_LINES);    
    for(int i=1; i<trazounox.size();i++){
      glVertex2f(trazounox[i-1], trazounoy[i-1]);//output vertex           
      glVertex2f(trazounox[i], trazounoy[i]);//output vertex           
    };
    glEnd();
    
  };


  
  //Update screen 1
  glutSwapBuffers();
  
};