Пример #1
0
//--------------------------------------------------------------
void testApp::draw(){
    ofSetWindowTitle(ofToString(ofGetFrameRate()));
    camera.begin();
    for (int i = 0; i < fingerPos.size(); i++) {
        ofVec3f pt;
        pt = fingerPos[i];
        drawSphere(pt, 3);
    }
    
 
        ofVec3f pt = ofVec3f(0);
        drawSphere(pt, 7);
    
//    if (phase2 && (!spherePos.empty())) {
//        ofVec3f temp = spherePos[0];
//        temp.z = -90;
//        drawSphere(temp, 20);
//    }
//    if (phase3 && (!sphereSize.empty())) {
//        ofVec3f pt = ofVec3f(0,0);
//        pt.z = -150;
//        drawSphere(pt, sphereSize[0]);
//    }
    camera.end();
}
Пример #2
0
void SampleModel::drawFace() {
	glPushMatrix();
	
	// eyes
	glTranslated(0.2, UPPER_TORSO_RADIUS + HEAD_RADIUS + 0.3, 0.7);
	if (VAL(TEXTURESKIN))
		drawTextureSphere(0.1);
	else drawSphere(0.1);
	glTranslated(-0.4, 0, 0);
	if (VAL(TEXTURESKIN))
		drawTextureSphere(0.1);
	else drawSphere(0.1);

	// nose
	setDiffuseColor(.940f, .816f, .811f);
	glTranslated( 0.2, -0.3, 0.1);
	if (VAL(TEXTURESKIN))
		drawTextureSphere(0.1);
	else drawSphere(0.1);

	glPopMatrix();

	// mouth
	glPushMatrix();

	setDiffuseColor(1.0f, 0.0f, 0.0f);
	glTranslated(-0.25, UPPER_TORSO_RADIUS + 0.3, 0.7);
	glRotated(20, 1.0, 0.0, 0.0);
	glTranslated(0.0, 0.0, -0.05);
	if (VAL(TEXTURESKIN))
		drawTextureBox(0.5,0.3,0);
	else drawBox(0.5,0.3,0);

	glPopMatrix();
}
Пример #3
0
void drawBanana1(void)
{
	mvstack.push(model_view);
	set_colour(.95, .9, .8);
	model_view *= Scale(0.08, 0.2, 0.1);
	model_view *= RotateX(90);
	drawSphere();
	model_view = mvstack.pop();

	mvstack.push(model_view);
	set_colour(.95, .9, .1);
	model_view *= Scale(0.1, 0.3, 0.112);
	model_view *= Translate (0, -.5, 0);
	model_view *= RotateX(90);
	drawSphere();
	model_view = mvstack.pop();

	mvstack.push(model_view);
	set_colour (.1, .1, .2);
	model_view *= Translate(0, -0.45, 0);
	model_view *= Scale(.025, .025,.025);
	drawSphere();
	model_view = mvstack.pop();


}
Пример #4
0
void drawHead1(void)
{
		//head
	mvstack.push(model_view);
		set_colour(.95, .9, .75);
		drawSphere();
	model_view = mvstack.pop();

	//eyes
	mvstack.push(model_view);
		set_colour(.1,.1,.1);
		model_view *= Translate(-.27, .3, .7);
		model_view *= Scale(.2, .2, .2);
		drawSphere();
	model_view = mvstack.pop();

	mvstack.push(model_view);
		set_colour(.1,.1,.1);
		model_view *= Translate(.27, .3, .7);
		model_view *= Scale(.2, .2, .2);
		drawSphere();
	model_view = mvstack.pop();

	
}
Пример #5
0
void SampleModel::drawUpperRightLeg() {
	glPushMatrix();
	glTranslated(0.9, -UPPER_TORSO_RADIUS - LOWER_TORSO_HEIGHT, 0);
	glRotated(VAL(RIGHTKNEE), -1.0, 0.0, 0.0);
	glRotated(VAL(RIGHTLEGX), -1.0, 0, 0);
	glRotated(VAL(RIGHTLEGZ), 0.0, 0, 1.0);
	if (VAL(TEXTURESKIN))
		drawTextureSphere(0.3);
	else drawSphere(0.3);

	if (animate) {
		glRotated(-animUpperLegAngle, 1.0, 0, 0);
		SETVAL(RIGHTKNEE, 0);
	}

	glTranslated(0, -0.7, 0);
	glRotated(90, 1.0, 0.0, 0.0);
	glTranslated(0, 0, -0.6);
	if (VAL(TEXTURESKIN)) {
		drawTextureCylinder(1.2, 0.35, 0.35);
		glTranslated(0, 0, 1.25);
		drawTextureSphere(0.3);
	}
	else {
		drawCylinder(1.2, 0.35, 0.35);
		glTranslated(0, 0, 1.25);
		drawSphere(0.3);
	}
}
Пример #6
0
void GFXDrawUtil::_drawSolidCapsule( const GFXStateBlockDesc &desc, const Point3F &center, F32 radius, F32 height, const ColorI &color, const MatrixF *xfm )
{	
   MatrixF mat;
   if ( xfm )
      mat = *xfm;      
   else
      mat = MatrixF::Identity;

   S32 numPoints = sizeof(circlePoints)/sizeof(Point2F);
   GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, numPoints * 2 + 2, GFXBufferTypeVolatile);
   verts.lock();

   for (S32 i=0; i<numPoints + 1; i++)
   {
      S32 imod = i % numPoints;      
      verts[2 * i].point = Point3F( circlePoints[imod].x * radius, circlePoints[imod].y * radius, height );
      verts[2 * i].color = color;
      verts[2 * i + 1].point = Point3F( circlePoints[imod].x * radius, circlePoints[imod].y * radius, -height );
      verts[2 * i + 1].color = color;
   }

   S32 totalNumPnts = numPoints * 2 + 2;

   // Apply xfm if we were passed one.
   for ( U32 i = 0; i < totalNumPnts; i++ )
      mat.mulP( verts[i].point );

   // Apply position offset
   for ( U32 i = 0; i < totalNumPnts; i++ )
      verts[i].point += center;

   verts.unlock();

   mDevice->setStateBlockByDesc( desc );

   mDevice->setVertexBuffer( verts );
   mDevice->setupGenericShaders();

   mDevice->drawPrimitive( GFXTriangleStrip, 0, 2 * numPoints );

   Point3F sphereCenter;
   MatrixF sphereMat;

   if ( xfm )
      sphereMat = *xfm;
   else
      sphereMat = MatrixF::Identity;   

   sphereCenter.set( 0, 0, 0.5f * height );
   mat.mulV( sphereCenter );
   sphereCenter += center;

   drawSphere( desc, radius, sphereCenter, color, true, false, &sphereMat );

   sphereCenter.set( 0, 0, -0.5f * height );
   mat.mulV( sphereCenter );
   sphereCenter += center;

   drawSphere( desc, radius, sphereCenter, color, false, true, &sphereMat );
}
Пример #7
0
void World::draw(RenderMode render_mode)
{
	if (render_mode == NORMAL) {
#ifndef PICTURE
		for (int i = 0; i<cursors.size(); i++)
			cursors[i]->draw();
		for (int i = 0; i<objs.size(); i++)
			objs[i]->draw();
#else
		vector<EndEffector*> end_effs;
		getObjects<EndEffector>(end_effs);
		if (end_effs.size() > 0)
			end_effs[0]->draw();
		if (end_effs.size() > 1) {
			glColor3f(0.3, 0.3, 0.3);
			drawSphere(end_effs[1]->getPosition(), 4.0);
		}
		if (end_effs.size() > 2)
			end_effs[2]->draw();
		if (end_effs.size() > 3) {
			glColor3f(0.3, 0.3, 0.3);
			drawSphere(end_effs[3]->getPosition(), 4.0);
		}
		if (end_effs.size() > 4)
			end_effs[4]->draw();
		
		vector<InfinitePlane*> planes;
		getObjects<InfinitePlane>(planes);
		if (planes.size() > 0)
			planes[0]->draw();
#endif
		for (int i = 0; i<threads.size(); i++)
			threads[i]->draw(false);
	} else if (render_mode == EXAMINE) {
		for (int i = 0; i<cursors.size(); i++)
			cursors[i]->draw();
		for (int i = 0; i<objs.size(); i++)
			objs[i]->draw();
		for (int i = 0; i<threads.size(); i++)
			threads[i]->draw(true);
	} else if (render_mode == DEBUG) {
		for (int i = 0; i<cursors.size(); i++)
			cursors[i]->draw();
		for (int i = 0; i<threads.size(); i++)
			threads[i]->drawDebug();
		for (int i = 0; i<objs.size(); i++)
			objs[i]->drawDebug();
	} else {
		if (collision_world != NULL) {
			btCollisionObjectArray col_objs = collision_world->collision_world->getCollisionObjectArray();
			glColor3f(0,0.8,0.6);
			for (int i = 0; i < col_objs.size(); i++) {
				drawCapsule(col_objs[i], true);
			}
		}
	}
	if (collision_world != NULL)
		collision_world->drawAllCollisions();
}
Пример #8
0
void System::drawAll(){
	if(updateDraw){
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glEnable(GL_DEPTH_TEST);
		glFrontFace(GL_CCW);
		glCullFace(GL_BACK);
		glEnable(GL_CULL_FACE);
		glDepthFunc(GL_LEQUAL);
		glClearDepth(1.0);

		glPointSize(2);
		glLoadIdentity();


		float4 pitch_quat=CreateFromAxisAngle(cross(dir,camera_up), camera_pitch);
		float4 heading_quat=CreateFromAxisAngle(camera_up, camera_heading);

		dir=quatRotate(dir,normalize(mult(pitch_quat,heading_quat)));
		camera_pos+=camera_pos_delta;
		look_at=camera_pos+dir*1;

		camera_heading*=.5;
		camera_pitch*=.5;
		camera_pos_delta*=.5;

		gluLookAt(	
			camera_pos.x, camera_pos.y, camera_pos.z,
			look_at.x, look_at.y,  look_at.z,
			camera_up.x, camera_up.y,  camera_up.z);

		for(int i=0; i<mSystem->Get_bodylist()->size(); i++){
			ChBody* abody=mSystem->Get_bodylist()->at(i);
			if(abody->GetCollisionModel()->GetShapeType()==SPHERE){
				drawSphere((abody)->GetPos(),(abody)->GetPos_dt().Length(), mSphereRadius);
			}
			if(abody->GetCollisionModel()->GetShapeType()==BOX){
				drawBox(abody,mSphereRadius,mGPUSys);
			}
			if(abody->GetCollisionModel()->GetShapeType()==ELLIPSOID){
				drawSphere(abody,mGPUSys);
			}
			if(abody->GetCollisionModel()->GetShapeType()==TRIANGLEMESH){
				glColor3f (0,0,0);
				drawTriMesh(TriMesh,(abody));
			}
		}

#if defined( _WINDOWS )
		Sleep( 30 );
#else
		usleep( 30 * 1000 );
#endif
		glutSwapBuffers();
	}
}
Пример #9
0
void Needle::draw()
{
	glColor3f(color0, color1, color2);
 	int obj_ind;
  for (obj_ind = 0; obj_ind<i_objs.size(); obj_ind++) {
 		drawCylinder(i_objs[obj_ind]->_start_pos, i_objs[obj_ind]->_end_pos, i_objs[obj_ind]->_radius);
		drawSphere(i_objs[obj_ind]->_start_pos, i_objs[obj_ind]->_radius);
	}	
	drawSphere(i_objs[obj_ind-1]->_end_pos, i_objs[obj_ind-1]->_radius);
	glColor3f(1,0,0);
	drawSphere(i_objs[0]->_start_pos, i_objs[0]->_radius);
}
Пример #10
0
void drawHelixLine(float cx, float cy, float r, float angle=180)
{
	float x1, x2, y1, y2, z1, z2, theta;
	int i, n = 565, k=0;
	GLubyte colors[2][3];
	angle = angle * PI / 180.0;
    for(i=0; i<n; i+=n/10)
    {
	    	theta = 2.0 * PI * i / n;
	    	x1 = cx - (r * sinf(1 * theta));
	    	y1 = cy + i;
	    	z1 = r * cosf(1 * theta);

	    	x2 = cx - (r * sinf(1 * theta + angle));
	    	y2 = cy + i;
	    	z2 = r * cosf(1 * theta + angle);

	    switch(k)
	    {	
	    	case 0: colors[0][0] = 46; colors[0][1] = 204; colors[0][2] = 113;		//turquoise
	    			colors[1][0] = 249; colors[1][1] = 148; colors[1][2] = 6;		//orange
	    			break;
	    	case 1: colors[0][0] = 249; colors[0][1] = 191; colors[0][2] = 59;		//yellow
	    			colors[1][0] = 155; colors[1][1] = 89; colors[1][2] = 182;		//amethyst
	    			break;
	    	case 2:	colors[0][0] = 249; colors[0][1] = 148; colors[0][2] = 6;
	    			colors[1][0] = 46; colors[1][1] = 204; colors[1][2] = 113;
	    			break;
	    	case 3: colors[0][0] = 155; colors[0][1] = 89; colors[0][2] = 182;
	    			colors[1][0] = 249; colors[1][1] = 191; colors[1][2] = 59;	    	
	    }
		glBegin(GL_LINE_STRIP);

        	glColor3ubv(colors[0]);
	    	glVertex3f(x1, y1, z1);
	    	glVertex3f((x1+x2)/2, (y1+y2)/2, (z1+z2)/2);
        	glColor3ubv(colors[1]);
	    	glVertex3f((x1+x2)/2, (y1+y2)/2, (z1+z2)/2);
	    	glVertex3f(x2, y2, z2);
			
		glEnd();

        glColor3ub(52, 73, 94);
        drawSphere(x1, y1, z1);
        drawSphere(x2, y2, z2);

        k++;
        if (k>3) k=0;
    }
}
Пример #11
0
void CPolyOff6_11::displayEvent()
{
	GLfloat gray[] = { 0.8, 0.8, 0.8, 1.0 };
	GLfloat black[] = { 0.0, 0.0, 0.0, 1.0 };

	glDisable(GL_LIGHTING);
	glDisable(GL_LIGHT0);
	CLearnOpenGLBase::displayEvent();

	drawSphere(radius * 2 + 0.1, radius * 2 + 0.1, 0, true);
	drawSphere(-radius * 2 + 0.1, radius * 2 + 0.1, 0, false);


	glutSwapBuffers();
}
Пример #12
0
void drawCoordWidget(float size,float thickness,float arrowSize,float arrowWidth)
{
  glEnable(GL_LIGHTING);
  float white[]={1,1,1,1};
  float red[]={1,0,0,1};
  float green[]={0,1,0,1};
  float blue[]={0,0,1,1};

  glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,white);
  drawSphere(size*thickness*2.0,16,8);
  glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,red);
  drawCylinder(Vector3(size*(1.0-arrowSize),0,0),size*thickness,8);
  glPushMatrix();
  glTranslatef(size*(1.0-arrowSize),0,0);
  drawCone(Vector3(size*arrowSize,0,0),size*arrowWidth,8);
  glPopMatrix();
  glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,green);
  drawCylinder(Vector3(0,size*(1.0-arrowSize),0),size*thickness,8);
  glPushMatrix();
  glTranslatef(0,size*(1.0-arrowSize),0);
  drawCone(Vector3(0,size*arrowSize,0),size*arrowWidth,8);
  glPopMatrix();
  glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,blue);
  drawCylinder(Vector3(0,0,size*(1.0-arrowSize)),size*thickness,8);
  glPushMatrix();
  glTranslatef(0,0,size*(1.0-arrowSize));
  drawCone(Vector3(0,0,size*arrowSize),size*arrowWidth,8);
  glPopMatrix();
}
Пример #13
0
void createFurnishings()
{
	glTranslatef(0,  -height + 2 * wide / 8,  - Dept+2 * Dept / 8);
	drawSphere();
	glTranslatef(0, height - 2 * wide / 8, Dept - 2 * Dept / 8);
	cone();
}
Пример #14
0
void createLightAndProxy(GLenum mode)
{
	glTranslatef(2 * movex / wide_screen, 2 * movey / height_screen, 2 * movez / wide_screen);

	glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.5);
	glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0);
	glLightfv(GL_LIGHT0, GL_POSITION, light_postion);
	glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
	glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);

	if(mode == GL_SELECT)
	{
		glLoadName(1);
	}
	if(flag_light == 1)
		drawSphere(proxy[0], proxy[1] - wide / 12, proxy[2], 1);

	glTranslatef( -2 * movex / wide_screen,  -2 * movey / height_screen,  -2 * movez / wide_screen);

	if(mode == GL_SELECT)
	{
		glLoadName(2);
	}
}
Пример #15
0
void drawTopArm2Right(void)
{
	mvstack.push(model_view);
		set_colour(.95, .9, .75);
		model_view *= Translate (.75, -1.25, 0);
		model_view *= Scale(.25, .5, .25);
		drawSphere();
	model_view = mvstack.pop();

	mvstack.push(model_view);
		set_colour(.95, .9, .75);
		model_view *= Translate (.75, -2, 0);
		model_view *= Scale(.25, .3, .25);
		drawSphere();
	model_view = mvstack.pop();
}
Пример #16
0
void SampleModel::drawUpperTorso() {
	glPushMatrix();
	if (VAL(TEXTURESKIN))
		drawTextureSphere(UPPER_TORSO_RADIUS);
	else drawSphere(UPPER_TORSO_RADIUS); // center at (0, 0, 0)
	glPopMatrix();
}
Пример #17
0
void drawFlower()
{
	float theta;
	mvstack.push(model_view);
	for (int i = 0; i <8; i++){
		
		theta =5*sin(30*DegreesToRadians*TIME);
		model_view *= RotateZ(theta);
		model_view *= Translate(0.0f, 1, 0.0f);
		mvstack.push(model_view);
		model_view *= Scale(1, 2, 1);
		set_colour(0.545f, 0.271f, 0.075f);
		drawCube();
		model_view = mvstack.top();
		mvstack.pop();
		model_view *= Translate(0.0f, 1, 0.0f);
		if (i == 7)
		{
			model_view *= RotateZ(theta);
			model_view *= Translate(0, 2, 0);
			model_view *= Scale(2, 2, 2);
			set_colour(1.0f, 0.0f, 0.0f);
			drawSphere();
		}
	}
	model_view = mvstack.top();
	mvstack.pop();
}
Пример #18
0
void glutDisplay (void)

{

    if (!winH)

        return;



    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);



	glMatrixMode (GL_MODELVIEW);

	glLoadIdentity ();

	glTranslatef (0, 0, -50); /* eye position */



    drawFace ();

    drawSphere ();



	glutSwapBuffers();

}
Пример #19
0
/** Render initial_state */
void ParticleSystem::drawParticles(float t)
{
	if (simulate){
		float roundedTime = round(t*bake_fps) / bake_fps;
		Particle* p = particles;
		// check if the initial_state are already baked at this time
		if (!bakedParticles.empty() && bakedParticles.count(roundedTime)){
			p = bakedParticles.at(roundedTime);
		}

		// draw shape
		double size = 0.05;
		float grayColor = (rand() % 100) / 100.0;
		setDiffuseColor(grayColor,grayColor,grayColor);
		for (int i = 0; i < n; i++){
			float* location = p[i].getPositionVectors();
			glPushMatrix();
			glTranslated(location[0], location[1], location[2]);
			glTranslated(-size / 2, -size / 2, -size / 2);
			drawSphere(size);
			//drawBox(size, size, size);
			glPopMatrix();
		}
	}

}
Пример #20
0
void PointSet::Draw ( float* view_mat, float rad )
{
	char* dat;
	Point* p;
	glEnable ( GL_NORMALIZE );	

	if ( m_Param[PNT_DRAWMODE] == 0 ) {
		glLoadMatrixf ( view_mat );
		dat = mBuf[0].data;	
		for (int n = 0; n < NumPoints(); n++) {
			p = (Point*) dat;
			glPushMatrix ();
			glTranslatef ( p->pos.x, p->pos.y, p->pos.z );		
			glScalef ( 0.2, 0.2, 0.2 );	
			if(p->type == 0)
			glColor4f ( 0.1,0.3,1.0,1.0 );//glColor4f ( RED(p->clr), GRN(p->clr), BLUE(p->clr), ALPH(p->clr) );
			else
            glColor4f ( RED(p->clr), GRN(p->clr), BLUE(p->clr), 0.0 );
			drawSphere ();
			glPopMatrix ();		
			dat += mBuf[0].stride;
		}	
	} else if ( m_Param[PNT_DRAWMODE] == 1 ) {
		glLoadMatrixf ( view_mat );
		dat = mBuf[0].data;
		glBegin ( GL_POINTS );
		for (int n=0; n < NumPoints(); n++) {
			p = (Point*) dat;
			glColor3f ( RED(p->clr), GRN(p->clr), BLUE(p->clr) );			
			glVertex3f ( p->pos.x, p->pos.y, p->pos.z );			
			dat += mBuf[0].stride;
		}
		glEnd ();
	}
}
Пример #21
0
void Desenha (void)
{
	int i=0;
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	glPushMatrix();
	//glScalef (x_0, y_0, z_0);
	//glRotatef (270, 1, 0, 0);
	//glRotatef (rotacao, 0, 0, 1);
	glRotatef (rotacao, 1, 1, 1);

		
		
		drawSphere(1.0+x_0,100+v);
		//vertices_esfera (1.0);
		//desenhar_esfera (100);
	
	
	//glutWireSphere (1.0,10,10);
	//desenhar_esfera (100);
	
	glPopMatrix();

	glutSwapBuffers();

}
Пример #22
0
void patrolUnit::OpenGLDraw(const MapProvider *mp, const SimulationInfo *) const
{
    GLdouble xx, yy, zz, rad;
    Map *map = mp->GetMap();
    int posx = x, posy = y;
    map->GetOpenGLCoord(posx, posy, xx, yy, zz, rad);
    glColor3f(r, g, b);
    glBegin(GL_LINE_STRIP);
//	glVertex3f(xx, yy+rad/2, zz);
    glVertex3f(xx, yy, zz-rad/2);
    for (int t = moves.size()-1; t >= 0; t--)
    {
        posx += ((moves[t]&kE)?1:0) - ((moves[t]&kW)?1:0);
        posy += ((moves[t]&kS)?1:0) - ((moves[t]&kN)?1:0);

        map->GetOpenGLCoord(posx, posy, xx, yy, zz, rad);

//		glVertex3f(xx, yy+rad/2, zz);
        glVertex3f(xx, yy, zz-rad/2);
    }
    glEnd();

    map->GetOpenGLCoord(x, y, xx, yy, zz, rad);
    glColor3f(r, g, b);
    drawSphere(xx, yy, zz, rad);
}
Пример #23
0
void OgreBtDebugDrawer::drawSphere(const Ogre::Vector3& p, const double size,
		const Ogre::ColourValue& colour) {
	if (mDebugDrawingEnabled) {
		drawSphere(OgreBulletUtils::convert(p), size,
				OgreBulletUtils::convert(colour));
	}
}
Пример #24
0
void drawBlade(float r, float g, float b)
{
	mvstack.push(model_view);
		set_colour(r,g,b);
		model_view *= Scale(0.5, 9, 0.5);
		drawSphere();
		model_view = mvstack.pop();
}
Пример #25
0
void SampleModel::drawHead() {
	glPushMatrix();
	glTranslated(0, UPPER_TORSO_RADIUS + HEAD_RADIUS, 0);
	if (VAL(TEXTURESKIN))
		drawTextureSphere(HEAD_RADIUS);
	else drawSphere(HEAD_RADIUS);
	glPopMatrix();
}
Пример #26
0
void MengMeiEye::onDraw()
{
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, m_texture);
		drawTexture(std::string("./res/MengMeiEye.jpg"), m_texture);
		drawSphere(0.15f);
	glDisable(GL_TEXTURE_2D);
}
Пример #27
0
void GraphicsPainter::drawSphere(const Point3f &center, float radius)
{
    glPushMatrix();
    glTranslated(center.x(), center.y(), center.z());

    drawSphere(radius);

    glPopMatrix();
}
Пример #28
0
void drawFlowerHead() {
        mvstack.push(model_view);
        set_colour(1.0, 0.0, 0.0);
        model_view *= RotateZ(12*sin(TIME));
        model_view *= Translate(0, 9.9, 0);
        model_view *= Scale(1.5, 1.5, 1.5);
        drawSphere();
        model_view = mvstack.pop();
}
Пример #29
0
void mDisplay(void){
   glClear(GL_COLOR_BUFFER_BIT);
   glColor3f(1.0, 1.0, 1.0);  // Setting fill color
   glLoadIdentity();
   if(DRAW_CYLINDER) drawCylinder();
   else drawSphere();
   glFlush();
   glutSwapBuffers();
}
void VSphereVBO::Fill()
{
	GLuint index = 0;
	drawSphere(NULL, index, mQuality, &mVertexCount);

	mStride = 6 * sizeof(GLfloat); // 3 floats for the pos, 3 for the normal
	int total = mVertexCount * mStride;
	index = 0;

	GLfloat *bufferData = new GLfloat[total];
	drawSphere(bufferData, index, mQuality, NULL);

	glBindBuffer(GL_ARRAY_BUFFER, mHandle);
	glBufferData(GL_ARRAY_BUFFER, total, bufferData, GL_STATIC_DRAW);
	glBindBuffer(GL_ARRAY_BUFFER, 0);

	delete []bufferData;
}