Пример #1
0
void SimpleObject::draw()
{
	GLUquadricObj *sphere;
	Vec3f v = velocity;
	Vec3f def = Vec3f(0.0,0.0,-1.0);
	Matrix44f rot;

	sphere = gluNewQuadric();
	normalize(v);
	rot = makeRot<Matrix44f>(v,def);

	glPushMatrix();
	//move to position:
	glTranslatef(position[0],position[1],position[2]);
	gluSphere(sphere, 0.03, 10, 10);
	//rotate cone:
	glMultMatrixf(rot.getData());
	//center cone:
	glTranslatef(-0.2,0.0,0.0);
	// base radius, height, slices, stacks
	glutSolidCone(0.1, 0.4, 5, 3);
	gluDeleteQuadric(sphere);
	glPopMatrix();
}