void CCombatDrone::Rander()
{
	glPushMatrix();
	{
		glTranslatef(m_pt.x, m_pt.y, m_pt.z);
		glRotatef(m_angle,0,1,0);
		GLfloat gray[] = { m_gray.x, m_gray.y, m_gray.z, 1.0f };
		GLfloat specref[] = { m_specref.x, m_specref.y, m_specref.z, 1.0f };
		glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, gray);
		glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specref);
		glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 128);
		float angle = sin(m_gearangle*PI / 180.0)*m_size*0.1;

		
		
		glRotatef(m_gearangle,1,1,1);
		glutSolidSphere(m_size*0.1, 10, 12);
		glutWireSphere(m_size*0.2 + angle, 6, 6);
		glRotatef(-m_gearangle, 1, 1, 1);

		glutWireCube(m_size+angle);
		
		

		glPushMatrix();
		{
			glTranslatef(0, 0, m_size*0.5 + angle);
			RandArmor();
			glTranslatef(0, 0, -m_size - angle * 2);
			RandArmor();
		}
		glPopMatrix();
		
		/*
		glPushMatrix();
		{
			glTranslatef(m_size + angle, 0, 0);
			glRotatef(90,0,1,0);
			RandGear(m_size*0.5, m_gearangle);
			glRotatef(-90, 0, 1, 0);
			glTranslatef(-m_size*2 - angle * 2, 0,0 );
			glRotatef(90, 0, 1, 0);
			RandGear(m_size*0.5, m_gearangle);
			glRotatef(-90, 0, 1, 0);
		}
		glPopMatrix();
		*/
		






	}
	glPopMatrix();
}
Exemple #2
0
void drawFood() {
	for(int i=0; i<foodcount;  i++) {
	  glPushMatrix();
		glColor4f(food[i].color.r, food[i].color.g, food[i].color.b, food[i].alpha);
		glTranslatef(food[i].position.x, food[i].position.y, food[i].position.z);
		glutWireSphere(OBJECTRADIUS,10,10);
	  glPopMatrix();
	}
}
Exemple #3
0
void
Sphere::renderGL()
{
    glColor3f(1, 1, 1);
    glPushMatrix();
    glTranslatef(m_center.x, m_center.y, m_center.z);
    glutWireSphere(m_radius, 20, 20);
    glPopMatrix();
}
Exemple #4
0
void drawLight()
{
	glDisable (GL_LIGHTING);
	glColor3f (1,1,0);
	glPushMatrix();
	glTranslated (lightpos[0][0], lightpos[0][1], lightpos[0][2]);
	glutWireSphere (.1,12,12);
	glPopMatrix();
}
Exemple #5
0
void DrawPlanet(double radius )
{
    glPushMatrix();
    {
        glRotatef ( 90.0, 1.0, 0.0, 0.0);
        glutWireSphere(radius, 20, 20);
    }
    glPopMatrix();
}
Exemple #6
0
void CBulletWorld::draw() {
	btTransform trans;
	ballRigidBody->getMotionState()->getWorldTransform(trans);
	glPushMatrix();
	btVector3 loc = trans.getOrigin();
	glTranslatef(loc[0], loc[1], loc[2]);
	glutWireSphere(1.0, 10, 10);
	glPopMatrix();
}
Exemple #7
0
void myGlutDisplay( void )
{
  glClearColor( .9f, .9f, .9f, 1.0f );
  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  glFrustum( -xy_aspect*.08, xy_aspect*.08, -.08, .08, .1, 15.0 );

  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
  glTranslatef( 0.0f, 0.0f, -1.6f );
  glRotatef( rotationY, 0.0, 1.0, 0.0 );
  glRotatef( rotationX, 1.0, 0.0, 0.0 );

  /*** Now we render object, using the variables 'obj', 'segments', and
    'wireframe'.  These are _live_ variables, which are transparently 
    updated by GLUI ***/
  
  if ( obj == 0 ) {
    if ( wireframe )      
      glutWireSphere( .6, segments, segments );
    else                  
      glutSolidSphere( .6, segments, segments );
  }
  else if ( obj == 1 ) {
    if ( wireframe )
      glutWireTorus( .2,.5,16,segments );
    else
      glutSolidTorus( .2,.5,16,segments );
  }
  else if ( obj == 2 ) {
    if ( wireframe )
      glutWireTeapot( .5 );
    else
      glutSolidTeapot( .5 );
  }

  glDisable( GL_LIGHTING );  /* Disable lighting while we render text */
  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  gluOrtho2D( 0.0, 100.0, 0.0, 100.0  );
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
  glColor3ub( 0, 0, 0 );
  glRasterPos2i( 10, 10 );

  //  printf( "text: %s\n", text );

  /*** Render the live character array 'text' ***/
  for (unsigned int i=0; i<text.length(); ++i)
    glutBitmapCharacter( GLUT_BITMAP_HELVETICA_18, text[i] );

  glEnable( GL_LIGHTING );

  glutSwapBuffers(); 
}
Exemple #8
0
void Ball::display() {
	
	ballMaterial();
	glColor4f(color[0] , color[1] , color[2] , 1.0);
	glPushMatrix();
		glTranslated( position[0] , position[1] , position[2] );
		if(isSelected) glutSolidSphere( radius , NUM_SLICES , NUM_STACKS);
		else glutWireSphere( radius , NUM_SLICES , NUM_STACKS);
	glPopMatrix();
}
void display()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glMatrixMode(GL_MODELVIEW);

	float rotationVertical = 360.0f/(float)_steps;	
	rotationVertical *=(float)_rotationVerticalStep;
	float rotationHorizontal = 360.0f/(float)_steps;
	rotationHorizontal *=(float)_rotationHrizontalStep;

	//plane
	glLoadIdentity();
	glTranslatef(0.0f, VerticalSteps, 0.0f);
	glTranslatef(HorizontalSteps, 0.0f, 0.0f);

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

	glRotatef(rotationVertical, 1.0f, 0.0f, 0.0f);
	glRotatef(rotationHorizontal, 0.0f, 1.0f, 0.0f);

	drawPlane();


	//Cube same tranforms plus rotation
	//glRotatef(anguloCuboX, 1.0f, 0.0f, 0.0f);
	glRotatef(anguloCuboY, 0.0f, 1.0f, 0.0f);
	drawCube();

	//reset matrix and set sphere
	glLoadIdentity();

	glTranslatef( 0.0f,VerticalSteps, 0.0f);
	glTranslatef(HorizontalSteps, 0.0f, 0.0f);

	glTranslatef(0.0f, 0.0f, -5.0f);
	glRotatef(rotationVertical, 1.0f, 0.0f, 0.0f);
	glRotatef(rotationHorizontal, 0.0f, 1.0f, 0.0f);

	glRotatef(anguloEsfera, 0.0f, 1.0f, 0.0f);
	glTranslatef(3.0f, 0.0f, 0.0f);

	

	glColor3f(1.0f, 0.0f, 0.5f);
	glutWireSphere(0.5f, 8, 8);

	glFlush();
	glutSwapBuffers();

	anguloCuboX+=0.1f;
	anguloCuboY+=0.1f;
	anguloEsfera-=0.2f;

	glutPostRedisplay();
}
void COpenGLView::RenderScene()	// 绘制函数 [8/20/2010 foryond]
{
// 	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// 	glClearDepth(1.0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	//m_Camera.DisplayScene();
	
	//---------------------------------------------------------------------
	// 此处添加绘制代码 [8/20/2010 foryond]
			//Draw Sun
		glTranslatef(0.0f,0.0f,-5.0f);
		glRotatef(6,1.0f,0.0f,0.0f);

		glutWireSphere(1.0f,20,20);

		//Draw Planet
		glPushMatrix();
			glTranslatef(-1.2f,-0.5f,-2.0f);
			glRotatef(6,1.0f,0.0f,0.0f);

			glutWireSphere(0.5f,20,20);

			//Draw Moon
			glPushMatrix();

			glTranslatef(-1.2f,-0.5f,-2.0f);
			glRotatef(6,1.0f,0.0f,0.0f);

			glutWireSphere(0.05f,20,20);

		glPopMatrix();

	glPopMatrix();

	//myinit();
	//auxReshapeFunc(reshape);
	//auxIdleFunc(stepDisplay);			
	//auxMainLoop(display);

	SwapBuffers(m_pDC->GetSafeHdc());
	
}
Exemple #11
0
void display(void)
{
    
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(65/100,105/100,170/100);
    glPushMatrix();
    glutWireSphere(1,50,80);
    glRotatef((GLfloat)year,1,0,0);
    glTranslatef(0,2,0);
    //    glRotatef((GLfloat)day,0,1,0);
    glutWireSphere(0.2,10,8);
    
    glTranslatef(0,0.3,0);
    glRotatef(0,0,1,0);
    glutWireSphere(0.05, 10, 8);
    
    glPopMatrix();
    glutSwapBuffers();
    glFlush();       
}
Exemple #12
0
int DrawCircle(Vec3d v,pdColor c,double r){
	glPushMatrix();
	glColor4d(c.r,c.g,c.b,c.a);
	GLfloat material[] = {(float)c.r,(float)c.g,(float)c.b,(float)c.a};
	glMaterialfv(GL_FRONT_AND_BACK , GL_AMBIENT_AND_DIFFUSE , material); 
	glTranslated(v.x,v.y,v.z);

	glutWireSphere(r,20,20);
	glPopMatrix();
	return 0;
}
Exemple #13
0
void Sphere::render()
{
	//set material and draw geometry
	
	this->Shape::apply_material();
	glutSolidSphere(this->radius_, 40, 20);
	
	GLfloat color2[] = {0.0,0.0,0.0, 0.0};
	glMaterialfv(GL_FRONT, GL_AMBIENT, color2);
	glutWireSphere(this->radius_+0.0005, 40, 20);
	
}
void display(float k, float m, float v, float b, float t){
	int i;
	const float distance = 3.0;
	atom a;

    GLint circle_points = 100;
    float angle;
    float x, y, z, x1, y1, z1, x0, y0, z0;
    x0 = 0.0; y0 = 0.0; z0 = 0.0;
    a.move(x0, y0, z0);
    a.set_k(k);
    a.set_m(m);
    a.set_t(t);
    a.set_b(b);

    angle = 90.0;
    
    x1 = (x0 + t*v*(1-b*t/(2*m))-k*pow(t,2)*x0/(2*m))*cos(angle*PI/180);
    y1 = (y0 + t*v*(1-b*t/(2*m))-k*pow(t,2)*y0/(2*m))*sin(angle*PI/180);
    z1 = 0.0;
    a.move(x1, y1, z1);

    do{
    	
    	x = a.position.get_x();
    	y = a.position.get_y();
    	z = a.position.get_z();
	    
    	draw_axis(WIDTH, HEIGHT);

		/*glPointSize(6.0);
		glBegin(GL_POINTS);
			glVertex3f(x, y, z);
		glEnd();
		glFlush();*/
		
		glClear(GL_COLOR_BUFFER_BIT);
		glColor3f(0.0, 0.7, 1.0);

		glPushMatrix();
		draw_axis(WIDTH, HEIGHT);
		glTranslatef(x, y, z);
		glutWireSphere(20, 16, 16); // draw the earth
		glPopMatrix();
		glutSwapBuffers();


		usleep(t*40000);
    }while(a.motion());
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glFlush();
}
Exemple #15
0
  virtual void render() {
    static const float kTeapotColor[] = { 0.6, 0.6, 0.6, 1.0 };
    static const float kSphereColor[] = { 0.3, 0.3, 0.8, 0.5 };

    glEnable(GL_LIGHTING);
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, kTeapotColor);
    glutSolidTeapot(0.5);

    glDisable(GL_LIGHTING);
    glColor4fv(kSphereColor);
    glutWireSphere(1, 20, 20);
  }
Exemple #16
0
static void hugsprim_glutWireSphere_11(HugsStackPtr hugs_root)
{
    HsDouble arg1;
    HsInt32 arg2;
    HsInt32 arg3;
    arg1 = hugs->getDouble();
    arg2 = hugs->getInt32();
    arg3 = hugs->getInt32();
    glutWireSphere(arg1, arg2, arg3);
    
    hugs->returnIO(hugs_root,0);
}
Exemple #17
0
void display(void)
{
	glClearColor(0, 0, 0, 0);
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(1.0, 1.0, 1.0);
	glRotatef(30, 1.0, 0.0, 0.0);
	glRotatef(30, 0.0, 1.0, 0.0);
//	glutWireCube(1);
//	glutWireTetrahedron();
	glutWireSphere(0.5,25,24);
	glFlush();
}
Exemple #18
0
void mainloop()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glutWireSphere(c_Re,20,10);
    glutWireSphere(c_Rgeo,20,10);

    glBegin(GL_LINE_STRIP);
    for(int i = 0; i < numpoints; i++) {
        if(i > 0 && points[i - 1].k == 0) {
            glEnd();
            glBegin(GL_LINE_STRIP);
        }
        glVertex3d(points[i].pos.x, points[i].pos.y, points[i].pos.z);
    }
    glEnd();

    glutSwapBuffers();

    for(int i = 0; i < 600; i++) { simul(); }
}
Exemple #19
0
/** WireSphere (radius, slices, stacks) -> none
 */
 static int glut_wire_sphere(lua_State *L) {
   /* test argument type */
 if (lua_isnumber(L, 1) && lua_isnumber(L, 2) && lua_isnumber(L, 3)) {

    /* call GLUT functions */
    glutWireSphere((GLdouble)lua_tonumber(L, 1), (GLint)lua_tonumber(L, 2), (GLint)lua_tonumber(L, 3));
 } else {
   luaL_error(L, "incorrect argument to function 'glut.WireSphere'");
 }

 return 0;
}
void display() {
    glEnable(GL_DEPTH_TEST); // without this planet will always be visible (even when behind the sun)

    // adding light
    GLfloat sun_light_position[] = {1.0, 1.0, -1.0, 0.0};
    glLightfv(GL_LIGHT0, GL_POSITION, sun_light_position);
    glEnable(GL_LIGHT0);
    glEnable(GL_LIGHTING);
    glEnable(GL_COLOR_MATERIAL); // without this line objects' color won't be used with lights

    glClearColor(0.1, 0.1, 0.13, 0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // sun
    glPushMatrix();
        glRotatef(spin, 0, 1, 0);
        glColor3f(1.0, 1.0, 0.0);
        glutWireSphere(0.2, 10, 10);
    glPopMatrix();

    // planet
    glPushMatrix();
        glRotatef(-10, 1, 0, 0); // incline for better view TODO should be in projection
        glRotatef(spin, 0, 1, 0);
        glTranslatef(0.9, 0, 0);
        glRotatef(spin * 3, 0, 1, 0);

        glColor3f(1.0, 1.0, 1.0);
        glutWireSphere(0.1, 10, 10);

        // moon
        glRotatef(spin, 0, 1, 0);
        glTranslatef(0.2, 0, 0);
        glRotatef(spin * 4, 0, 1, 0);
        glutWireSphere(0.02, 10, 10);

    glPopMatrix();

    glFlush();
}
Exemple #21
0
static void display(void)
{
    const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
    const double a = t*90.0;

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glColor3d(1,0,0);

    glPushMatrix();
        glTranslated(-2.4,1.2,-6);
        glRotated(60,1,0,0);
        glRotated(a,0,0,1);
        glutSolidSphere(1,slices,stacks);
    glPopMatrix();

    glPushMatrix();
        glTranslated(0,1.2,-6);
        glRotated(60,1,0,0);
        glRotated(a,0,0,1);
        glutSolidCone(1,1,slices,stacks);
    glPopMatrix();

    glPushMatrix();
        glTranslated(2.4,1.2,-6);
        glRotated(60,1,0,0);
        glRotated(a,0,0,1);
        glutSolidTorus(0.2,0.8,slices,stacks);
    glPopMatrix();

    glPushMatrix();
        glTranslated(-2.4,-1.2,-6);
        glRotated(60,1,0,0);
        glRotated(a,0,0,1);
        glutWireSphere(1,slices,stacks);
    glPopMatrix();

    glPushMatrix();
        glTranslated(0,-1.2,-6);
        glRotated(60,1,0,0);
        glRotated(a,0,0,1);
        glutWireCone(1,1,slices,stacks);
    glPopMatrix();

    glPushMatrix();
        glTranslated(2.4,-1.2,-6);
        glRotated(60,1,0,0);
        glRotated(a,0,0,1);
        glutWireTorus(0.2,0.8,slices,stacks);
    glPopMatrix();

    glutSwapBuffers();
}
Exemple #22
0
void display_planet(struct planet p) {
    glColor3f(HEX(p.color));
    glPushMatrix();
    glTranslatef(p.x, p.y, p.z);
    glRotatef(p.angle, 15, 25, 1);
    int lines = p.radius / 2.5;
    glutWireSphere(p.radius, lines, lines);
    glPopMatrix();
    
    if (p.satellite) {
        display_planet(*p.satellite);
    }
}
Exemple #23
0
void Display ()
{
  // kolor t³a - zawartoœæ bufora koloru
  glClearColor (0.8,0.8,0.8,0.0);

  // czyszczenie bufora koloru
  glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  glEnable(GL_DEPTH_TEST);

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  //glOrtho(-1, 1, -1, 1, 0, 2);
  glFrustum(-1, 1, -1, 1, 3, 8);

  //gluLookAt(0.1, 0.2, -3, 0, 0, -8, 0, 1, 0);

  glBegin(GL_POLYGON);
     glColor3f(0.1, 0.8, 0.1);
     glVertex3f(-0.4, 0.4, -4);
     glVertex3f(0.2, 0.4, -4);
     glVertex3f(0.2, -0.4, -4);
     glVertex3f(-0.4, -0.4, -4);
  glEnd();

  glBegin(GL_POLYGON);
     glColor3f(0.1, 0.1, 0.8);
     glVertex3f(0.2, 0.4, -4);
     glVertex3f(0.4, 0.4, -5.5);
     glVertex3f(0.4, -0.4, -5.5);
     glVertex3f(0.2, -0.4, -4);
  glEnd();

  glBegin(GL_POLYGON);
     glColor3f(0.8, 0.1, 0.1);
     glVertex3f(-0.8, 0.7, -5);
     glVertex3f(-0.3, 0.7, -6);
     glVertex3f(-0.3, -0.3, -6);
     glVertex3f(-0.8, -0.3, -5);
  glEnd();

glutWireCube(5);
glutWireTeapot(3.2);
glutWireSphere(4, 3, 3);

  // skierowanie poleceñ do wykonania
  glFlush ();

  // zamiana buforów koloru
  glutSwapBuffers();
}
  void AttitudeIndicatorPlugin::drawBall()
  {
    GLdouble eqn[4] = {0.0, 0.0, 1.0, 0.0};
    GLdouble eqn2[4] = {0.0, 0.0, -1.0, 0.0};
    GLdouble eqn4[4] = {0.0, 0.0, 1.0, 0.05};
    GLdouble eqn3[4] = {0.0, 0.0, -1.0, 0.05};

    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);

    glPushMatrix();

    glColor3f(0.392156863f, 0.584313725f, 0.929411765f);
    glRotated(90.0 + pitch_, 1.0, 0.0, 0.0);

    glRotated(roll_, 0.0, 1.0, 0.0);
    glRotated(yaw_, 0.0, 0.0, 1.0);
    glClipPlane(GL_CLIP_PLANE1, eqn2);
    glEnable(GL_CLIP_PLANE1);
    glutSolidSphere(.8, 20, 16);
    glDisable(GL_CLIP_PLANE1);
    glPopMatrix();

    glPushMatrix();

    glLineWidth(2);
    glColor3f(1.0f, 1.0f, 1.0f);
    glRotated(90.0 + pitch_, 1.0, 0.0, 0.0);
    glRotated(roll_, 0.0, 1.0, 0.0);
    glRotated(yaw_, 0.0, 0.0, 1.0);
    glClipPlane(GL_CLIP_PLANE3, eqn4);
    glClipPlane(GL_CLIP_PLANE2, eqn3);
    glEnable(GL_CLIP_PLANE2);
    glEnable(GL_CLIP_PLANE3);
    glutWireSphere(.801, 10, 16);
    glDisable(GL_CLIP_PLANE2);
    glDisable(GL_CLIP_PLANE3);
    glPopMatrix();

    glPushMatrix();
    glColor3f(0.62745098f, 0.321568627f, 0.176470588f);
    glRotated(90.0 + pitch_, 1.0, 0.0, 0.0);//x
    glRotated(roll_, 0.0, 1.0, 0.0);//y
    glRotated(yaw_, 0.0, 0.0, 1.0);//z
    glClipPlane(GL_CLIP_PLANE0, eqn);
    glEnable(GL_CLIP_PLANE0);
    glutSolidSphere(.8, 20, 16);
    glDisable(GL_CLIP_PLANE0);
    glPopMatrix();
    glDisable(GL_DEPTH_TEST);
  }
Exemple #25
0
void MQObject::drawSphere()
{
	glDisable( GL_LIGHTING );
	glColor3f( 0, 1.0, 0 );
	glPushMatrix();
		glTranslatef( pos.x, pos.y+radius, pos.z );

		glRotatef( rot.x, 1, 0, 0 );
		glRotatef( rot.y, 0, 1, 0 );
		glRotatef( rot.z, 0, 0, 1 );
		glutWireSphere( radius, 16, 16 );
	glPopMatrix();
	glEnable( GL_LIGHTING );
}
Exemple #26
0
void Sphere::render(){
	if (material != NULL)
		material->apply();
	else
		glColor3d(color[0], color[1], color[2]);
	switch (mode){
	case draw::SOLID:
		glutSolidSphere(radius, slices, stacks);
		break;
	case draw::WIRE:
		glutWireSphere(radius, slices, stacks);
		break;
	}
}
Exemple #27
0
void draw_last_point()
{
  if(last_point != NULL){
    vector< float > microm(3);
    neuronita->neuronToMicrometers(last_point->coords,microm);
    glPushMatrix();
    glTranslatef(microm[0],
                 microm[1],
                 microm[2]);
    glColor4f(0.0,1.0,0.0,0.5);
    glutWireSphere(last_point->coords[3], 10, 10);
    glPopMatrix();
  }
}
Exemple #28
0
void ball()
{
    float ballX,ballY,ballZ;
    int ifCollided=0;

    glPushMatrix();
    ballX=-15+front;
    ballY=6;
    ballZ=0+lr;

    if(ballZ>25)
    {
        ballZ=25;
        ballX=ballX+OBJECT_SIZE;
    }
    else if(ballZ<-25)
    {
        ballZ=-25;
        ballX=ballX+OBJECT_SIZE;
    }
    else
    {
        //Do Nothing
    }
    glTranslatef(ballX,ballY,ballZ);
    glColor3f(1,0,0);
    glutWireSphere(5,100,10);
    glPopMatrix();

    ifCollided=collisionTest(ballX+5,ballY,ballZ);
    //printf("%f\t%f\t%f\n",ballX,ballY,ballZ);
    if(ifCollided==1)
    {
       front=front-1;
       incX=0;
    }
    ifCollided=collisionTest(ballX,ballY,ballZ-5);
    if(ifCollided==1)
    {
        lr=lr+1;
        incX=0;
    }
    ifCollided=collisionTest(ballX,ballY,ballZ+5);
    if(ifCollided==1)
    {
        lr=lr-1;
        incX=0;
    }

}
void BuildSphereDisplayList(GLuint * solidSphereList, GLuint * wireSphereList)
{ 
  *solidSphereList = glGenLists(1);
  glNewList(*solidSphereList, GL_COMPILE);
    glColor4f(1,1,1,0.35);
    glutSolidSphere(1.0,25,25);
  glEndList();

  *wireSphereList = glGenLists(1);
  glNewList(*wireSphereList, GL_COMPILE);
    glColor3f(0,0,0);
    glutWireSphere(1.0,25,25);
  glEndList();
} 
Exemple #30
0
void MyWindow::drawSphere(vector<Sphere> spheres, bool flatShading)
{
	glColor3f(0.5f, 0.0f, 0.0f);
	vector<Sphere>::iterator iter;
	for (iter = spheres.begin(); iter != spheres.end(); ++iter)
	{
		glPushMatrix();
		//glLoadIdentity();
		glTranslatef(iter->center[0], iter->center[1], iter->center[2]);
		glutWireSphere(iter->radius, 16, 2);
		glPopMatrix();
	}
	
}