Ejemplo n.º 1
0
void display(void) 
{
  int count = 0;
  RTB_point *local_point;
  RTB_point temp_point_circle;
  RTB_point temp_point_cross;
  
  local_point = circle_pointer;
  
  glClearColor(0.0,0.0,0.0,1.0);
  glClear(GL_COLOR_BUFFER_BIT);
  glLoadIdentity();
  glTranslatef(0, 0, -max_circle_point * 2);
  
  while(local_point->previous != NULL)
  {
    count++;
    GpsDouble2XYRelative(local_point, &temp_point_circle);
     //glRotatef(rot,0,1,0);
     //glRotatef(rot,1,0,0);
     //glRotatef(rot,0,0,1);
    glColor3f(1,1,0);
    createcircle(1,0.2,1); 
    glTranslatef(-temp_point_circle.x, -temp_point_circle.y, 0);
    local_point = local_point->previous;
  }
  count++;
  //draw the first point
  //gluLookAt(circle_pointer_start->x, circle_pointer_start->y, 0, circle_pointer_start->x, circle_pointer_start->y, -max_circle_point * 2, 0, 1, 0);
  glColor3f(0,0,1);
  createcircle(1,0.2,1);

  glLoadIdentity();
  glTranslatef(0, 0, -max_circle_point * 2);
  
  //local_point = current_position;
  GpsDouble2XYAbsoluteFromStart(&current_position, &temp_point_cross);
  GpsDouble2XYAbsoluteFromStart(circle_pointer, &temp_point_circle);
  glTranslatef(temp_point_cross.x - temp_point_circle.x, temp_point_cross.y - temp_point_circle.y, 0);
  glColor3f(1,0,0);
  createcross(max_circle_point/10, max_circle_point/10);
  
  glutSwapBuffers();
}
Ejemplo n.º 2
0
 void electron3()
 {
	 // Angle of revolution around the nucleus   
	 static float fElect1 = 0.0f;

	

	 glPushMatrix();
	 glColor3f(0, 0, 1);
	 glRotatef(fElect1, 0.0f, 0.0f, 1.0f);
	 glutSolidSphere(10.0f, 15, 15);
	 glPushMatrix();
	 glRotatef(fElect1, 0.0f, 1.0f, 0.0f);
	 glRotated(180, 1, 0, 0);

	 glTranslatef(0.0f, 50.0f, 0.0f);
	 glColor3f(1, 0, 0);
	 glutSolidSphere(6.0f, 15, 15);
	 glPopMatrix();
	 glPushMatrix();
	 glRotatef(fElect1, 0.0f, 1.0f, 0.0f);
	 glRotated(-180, 0, 1, 0);

	 glTranslatef(0.0f, 50.0f, 0.0f);

	 glutSolidSphere(6.0f, 15, 15);
	 glPopMatrix();
	 glPushMatrix();
	 glRotatef(fElect1, 0.0f, 1.0f, 0.0f);
	 glRotated(180, 1, 0, 0);
	 glRotated(180, 1, 0, 0);

	 glTranslatef(0.0f, 90.0f, 0.0f);
	 glutSolidSphere(6.0f, 15, 15);
	 glTranslatef(20.0f, 0.0f, 0.0f);
	 glutSolidSphere(6.0f, 15, 15);
	 glPopMatrix();
	 glPushMatrix();
	 glRotatef(fElect1, 0.0f, 1.0f, 0.0f);
	 glRotated(-160, 0, 1, 0);

	 glTranslatef(0.0f, -80.0f, 0.0f);

	 glutSolidSphere(6.0f, 15, 15);
	 glTranslatef(20.0f, 0.0f, 0.0f);
	 glutSolidSphere(6.0f, 15, 15);
	 glPopMatrix();
	 glColor3f(1, 1, 1);
	 createcircle(0, 90, 0);
	 createcircle(0, 50, 0);
	 glPopMatrix();
	 glPushMatrix();
	 glTranslated(120, 70, 0);
	 glColor3f(0, 0, 1);
	 glRotatef(fElect1, 0.0f, 0.0f, 1.0f);
	 glutSolidSphere(10.0f, 15, 15);
	 glPushMatrix();
	 glRotatef(fElect1, 0.0f, 1.0f, 0.0f);
	 glRotated(180, 1, 0, 0);
	 glColor3f(1, 0, 0);
	 glTranslatef(0.0f, 50.0f, 0.0f);
	 glutSolidSphere(6.0f, 15, 15);
	 glTranslatef(0.0f, -100.0f, 0.0f);
	 glutSolidSphere(6.0f, 15, 15);
	 glPopMatrix();
	 glColor3f(1, 1, 1);
	 createcircle(0, 50, 0);
	 glPopMatrix();
	 glPushMatrix();
	 glTranslated(-120, -70, 0);
	 glColor3f(0, 0, 1);
	 glRotatef(fElect1, 0.0f, 0.0f, 1.0f);
	 glutSolidSphere(10.0f, 15, 15);
	 glPushMatrix();
	 glRotatef(fElect1, 0.0f, 1.0f, 0.0f);
	 glRotated(180, 1, 0, 0);
	 glColor3f(1, 0, 0);
	 glTranslatef(0.0f, 50.0f, 0.0f);
	 glutSolidSphere(6.0f, 15, 15);
	 glTranslatef(0.0f, -100.0f, 0.0f);
	 glutSolidSphere(6.0f, 15, 15);

	 glPopMatrix();
	 glColor3f(1, 1, 1);
	 createcircle(0, 50, 0);
	 glPopMatrix();



	 // Increment the angle of revolution   
	 fElect1 += 10.0f;
	 if (fElect1 > 360.0f)
		 fElect1 = 0.0f;
 }