Esempio n. 1
0
/* filled cone */
static Bool myCone(float radius) 
{
#if 0
  GLUquadricObj *quadObj;
  
  if ((quadObj = gluNewQuadric()) == 0)
    return False;
  gluQuadricDrawStyle(quadObj, (GLenum) GLU_FILL);
  gluCylinder(quadObj, radius, 0, radius * 2, 8, 1);
  gluDeleteQuadric(quadObj);
#else
    cone (0, 0, 0,
          0, 0, radius * 2,
          radius, 0,
          8, True, True, False);
#endif
  return True;
}
//
//	Translate into a GLU quadric object in a list.
//
void Ellipsoid3D::Update() {
	GLUquadricObj *glq = gluNewQuadric();
	mList.Start();
	if (mFlags & kGFWire) { // Wire Frame
		gluQuadricDrawStyle(glq, GLU_LINE);
    mColor.Draw();
	} else {
    RunMaterial();
  }
	
	glPushMatrix();
	glTranslatef(mOrigin.mX, mOrigin.mY, mOrigin.mZ);
	gluSphere(glq, mAxes[0].mX, 20, 20);
	glPopMatrix();
	
	mList.End();
	gluDeleteQuadric(glq);
}
Esempio n. 3
0
void tglDrawDisk(const TPointD &c, double r)
{
	if (r <= 0)
		return;

	double pixelSize = 1;
	int slices = 60;

	if (slices <= 0)
		slices = computeSlices(r, pixelSize) >> 1;

	glPushMatrix();
	glTranslated(c.x, c.y, 0.0);
	GLUquadric *quadric = gluNewQuadric();
	gluDisk(quadric, 0, r, slices, 1);
	gluDeleteQuadric(quadric);
	glPopMatrix();
}
Esempio n. 4
0
void GLWidget::gl_draw() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    if(m_data == 0)
        return;
    GLUquadricObj *pObj;
    pObj = gluNewQuadric();
    glTranslatef(0.0,0.0,m_z);
    glRotatef(m_angle,1.0,0.0,0.0);
    glTranslatef(-(float) m_data->getDimension(0)/2.0 + m_dx,-(float) m_data->getDimension(1)/2.0 + m_dy,0.0);

    //draw spins
    for(unsigned int i = 0; i < m_arrows.size(); i++)
        m_arrows.at(i).draw(pObj);

    gluDeleteQuadric(pObj);
}
Esempio n. 5
0
/**
 * @brief Print a Dome that actually is a sphere.
 * This function print a sphere whith the texture of a beautifull sky.
 */
void underTheDome(){
	//i'm not a big fan of the series but after breaking bad i start to whatch it.
	glPushAttrib(GL_LIGHTING_BIT);
		GLfloat material_col[] = {1.0, 1.0, 1.0};
		glMaterialfv(GL_FRONT, GL_EMISSION, material_col);
		glPushMatrix();
			GLUquadric *qobj = gluNewQuadric();
			gluQuadricTexture(qobj,GL_TRUE); 
			glRotatef(90, 1, 0, 0);
			glEnable(GL_TEXTURE_2D);
				glBindTexture(GL_TEXTURE_2D,texSky);
				gluSphere(qobj,100,1000,1000); 
				//	drawBox(50, GL_QUADS);
				gluDeleteQuadric(qobj); 
			glDisable(GL_TEXTURE_2D);
		glPopMatrix();
	glPopAttrib();

}
Esempio n. 6
0
// Draw function
void Arc::drawFunc()
{
   BEGIN_DLIST
   GLUquadricObj* qobj = gluNewQuadric();
   if (isFilled()) {
      gluQuadricDrawStyle(qobj, GLU_FILL);
   }
   else {
      gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
   }
   if (connected) {
      gluPartialDisk(qobj, 0, getRadius(), getSlices(), 2, startAngle, arcLength);
   }
   else {
      gluPartialDisk(qobj, getRadius(), getRadius(), getSlices(), 2, startAngle, arcLength);
   }
   gluDeleteQuadric(qobj);
   END_DLIST
}
Esempio n. 7
0
/*******************************************************************************
 Graphics main loop function.
*******************************************************************************/
void displayFunction(void)
{
    // Setup model transformations.
    glMatrixMode(GL_MODELVIEW); 
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix();

    setupGraphicsState();
    drawAxes(sphereRadius*3.0);

    // Draw the fixed sphere.
    static const hduVector3Dd fixedSpherePosition(0, 0, 0);
    static const float fixedSphereColor[4] = {.2, .8, .8, .8};
    GLUquadricObj* pQuadObj = gluNewQuadric();
    drawSphere(pQuadObj, fixedSpherePosition, fixedSphereColor, sphereRadius);

    // Get the current position of end effector.
    DeviceDisplayState state;
    hdScheduleSynchronous(DeviceStateCallback, &state,
                          HD_MIN_SCHEDULER_PRIORITY);

    // Draw a sphere to represent the haptic cursor and the dynamic 
    // charge.
    static const float dynamicSphereColor[4] = { .8, .2, .2, .8 };
    drawSphere(pQuadObj, 
               state.position,
               dynamicSphereColor,
               sphereRadius);    

    // Create the force vector.
    hduVector3Dd forceVector = 400.0 * forceField(state.position);
    
    drawForceVector(pQuadObj,
                    state.position,
                    forceVector,
                    sphereRadius*.1);

    gluDeleteQuadric(pQuadObj);
  
    glPopMatrix();
    glutSwapBuffers();                      
}
Esempio n. 8
0
void drawRightEar() {
  glRotatef(earsRot, 0, 0, 1);
  glRotatef(-90.0f, 1, 0, 0);
  glRotatef(9.0f, 0, 1, 0);
  glTranslatef(4.0, 0, 5);
  glColor3f(1.0, 1.0, 1.0);
  
  GLUquadricObj* ear = gluNewQuadric();
  gluCylinder(ear, 1.0, 1.0, 6, 100, 20);
        
  glPushMatrix();
    glColor3f(0.0, 0.0, 0.0);
    glTranslatef(0, 0, 6);
        
    glutSolidCone(1.0, 2, 100, 10);
  glPopMatrix();

  gluDeleteQuadric(ear);
}
Esempio n. 9
0
void			draw_food()
{
	GLUquadric	*params;
	extern t_client	t;
	extern GLuint	type7;
	
	glPushMatrix();
	params = gluNewQuadric();
	glBindTexture(GL_TEXTURE_2D, type7);
	glColor3ub(255, 255, 255);
	gluQuadricTexture(params, GL_TRUE);
	glTranslated(t.x_pos * 2 + 1, t.y_pos * 2 + 1, 0);
	gluCylinder(params, 0.5, 0.5, 0.8, 20, 1);
	glTranslated(0, 0, 0.8);
	glRotated(90, 0, 0, 1);
	gluDisk(params, 0, 0.5, 20, 1);
	gluDeleteQuadric(params);
	glPopMatrix();	
}
Esempio n. 10
0
	void drawSphere(float Radius, GLint Slices, GLint Rings)
	{


		GLUquadricObj* SpherePointer;

		glPushMatrix();		

		SpherePointer = gluNewQuadric();
								
		gluQuadricDrawStyle(SpherePointer, Wired_or_Shade);

		gluSphere(SpherePointer, Radius, Slices, Rings);
								
		gluDeleteQuadric(SpherePointer);
								
		glPopMatrix();

	}
Esempio n. 11
0
// Draw the cursor
void drawCursor()
{
    static const int kCursorTess = 15;

    // Haptic cursor position in "world coordinates"
    double cursorPosWC[3];

    // Must synch before data is valid
    gHaptics.synchFromServo();
    gHaptics.getPosition(cursorPosWC);

    // The color will depend on the button state.
    gCurrentColor = gHaptics.isButtonDown() ? colorRed : colorTeal;

    GLUquadricObj *qobj = 0;

    glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT);
    glPushMatrix();

    // Page 505-506 of The Red Book recommends using a display list
    // for static quadrics such as spheres
    if (!gCursorDisplayList)
    {
        gCursorDisplayList = glGenLists(1);
        glNewList(gCursorDisplayList, GL_COMPILE);
        qobj = gluNewQuadric();

        gluSphere(qobj, gCursorRadius, kCursorTess, kCursorTess);
        
        gluDeleteQuadric(qobj);
        glEndList();
    }

    glTranslatef(cursorPosWC[0], cursorPosWC[1], cursorPosWC[2]);

    glEnable(GL_COLOR_MATERIAL);
    glColor3fv(gCurrentColor);

    glCallList(gCursorDisplayList);

    glPopMatrix(); 
    glPopAttrib();
}
Esempio n. 12
0
/* simple filled sphere */
static Bool mySphere(float radius) 
{
#if 0
  GLUquadricObj *quadObj;

  if((quadObj = gluNewQuadric()) == 0)
    return False;
  gluQuadricDrawStyle(quadObj, (GLenum) GLU_FILL);
  gluSphere(quadObj, radius, 16, 16);
  gluDeleteQuadric(quadObj);
#else
    glPushMatrix();
    glScalef (radius, radius, radius);
    glRotatef (90, 1, 0, 0);
    unit_sphere (16, 16, False);
    glPopMatrix();
#endif
  return True;
}
void Sphere::drawShape(GLuint texture) {
	this->quad = gluNewQuadric();
	gluQuadricTexture(this->quad, GL_TRUE);
	gluQuadricOrientation(this->quad, GLU_OUTSIDE);
	gluQuadricNormals(this->quad, GLU_SMOOTH);
	glPushMatrix();
	this->ctm_multiply();
	glEnable(GL_TEXTURE_2D);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glBindTexture(GL_TEXTURE_2D, texture);
	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
	gluSphere(this->quad, radius, 50, 50);

	//glColor4f(color[0], color[1], color[2], color[3]);
	glPopMatrix();
	glDisable(GL_TEXTURE_2D);
	gluDeleteQuadric(this->quad);
}
Esempio n. 14
0
// [Assignment2] you may need to revise this function
void Skeleton::display() {
	if (root == NULL) {
		return;
	}
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glScalef(0.05, 0.05, 0.05);

	GLUquadric* quad = gluNewQuadric(); //Create a new quadric to allow you to draw cylinders
	if (quad == 0) {
		printf("Not enough memory to allocate space to draw\n");
		exit(EXIT_FAILURE);
	}
	//Actually draw the skeleton
	display(root, quad);

	gluDeleteQuadric(quad);
	glPopMatrix();
}
Esempio n. 15
0
void makeMickey()
	{
        GLUquadricObj* qsphere = gluNewQuadric();
	glNewList(MICKEY, GL_COMPILE);

    	gluQuadricDrawStyle(qsphere, GLU_FILL);
    	gluQuadricNormals(qsphere, GLU_SMOOTH);
    	gluQuadricOrientation(qsphere, GLU_OUTSIDE);
    	gluQuadricTexture(qsphere, GL_FALSE);

    	glColor3f(1,1,0);
    	gluSphere(qsphere, 13, 20, 20);
    	glTranslatef(14,14,0);
    	gluSphere(qsphere, 10, 20, 20);
    	glTranslatef(-28,0,0);
    	gluSphere(qsphere, 10, 20, 20);
    	glEndList();
        gluDeleteQuadric(qsphere);
	}
Esempio n. 16
0
/* draw a given stroke - just a single dot (only one point) */
static void gp_draw_stroke_point(bGPDspoint *points, short thickness, short dflag, short sflag,
                                 int offsx, int offsy, int winx, int winy)
{
	/* set point thickness (since there's only one of these) */
	glPointSize((float)(thickness + 2) * points->pressure);
	
	/* draw point */
	if (sflag & GP_STROKE_3DSPACE) {
		glBegin(GL_POINTS);
		glVertex3fv(&points->x);
		glEnd();
	}
	else {
		float co[2];
		
		/* get coordinates of point */
		gp_calc_2d_stroke_xy(points, sflag, offsx, offsy, winx, winy, co);
		
		/* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, simple dot looks ok
		 *  - also mandatory in if Image Editor 'image-based' dot
		 */
		if ((thickness < GP_DRAWTHICKNESS_SPECIAL) ||
		    ((dflag & GP_DRAWDATA_IEDITHACK) && (sflag & GP_STROKE_2DSPACE)))
		{
			glBegin(GL_POINTS);
			glVertex2fv(co);
			glEnd();
		}
		else {
			/* draw filled circle as is done in circf (but without the matrix push/pops which screwed things up) */
			GLUquadricObj *qobj = gluNewQuadric();
			
			gluQuadricDrawStyle(qobj, GLU_FILL);
			
			/* need to translate drawing position, but must reset after too! */
			glTranslate2fv(co);
			gluDisk(qobj, 0.0,  thickness, 32, 1);
			glTranslatef(-co[0], -co[1], 0.0);
			
			gluDeleteQuadric(qobj);
		}
	}
}
Esempio n. 17
0
void SimpleDraw::DrawCylinder( const Vec& center, const Vec& direction /*= Vec(0,0,1)*/,
							  float height, float radius /*= 1.0f*/, float radius2 /*= -1*/ )
{
	glPushMatrix();
	glTranslatef(center.x, center.y, center.z);
	glMultMatrixd(qglviewer::Quaternion(Vec(0,0,1), direction).matrix());

	GLUquadricObj *quadObj = gluNewQuadric();
	gluQuadricDrawStyle(quadObj, GLU_FILL);
	gluQuadricNormals(quadObj, GLU_SMOOTH);

	if(radius2 < 0)
		radius2 = radius;

	gluCylinder(quadObj, radius, radius2, height, 16, 16);

	gluDeleteQuadric(quadObj);
	glPopMatrix();
}
Esempio n. 18
0
void SphereParts::draw(GLContext &c)
{
	const dReal * m = getRotation();

	// R(gl)
	const dReal *pos_ = getPosition();
	Position pos(pos_[0], pos_[1], pos_[2]);

	DEF_R(r, pos, m);

	glMultMatrixd(r);

	double radius = m_cmpnt->radius();

	GLUquadricObj *quad = gluNewQuadric();
	gluQuadricDrawStyle(quad, GLU_FILL);
	gluSphere(quad, radius, 10, 10);
	gluDeleteQuadric(quad);
}
Esempio n. 19
0
void Gl1_Cylinder::drawCylinder(bool wire, Real radius, Real length, const Quaternionr& shift) const
{
   glPushMatrix();
   GLUquadricObj *quadObj = gluNewQuadric();
   gluQuadricDrawStyle(quadObj, (GLenum) (wire ? GLU_SILHOUETTE : GLU_FILL));
   gluQuadricNormals(quadObj, (GLenum) GLU_SMOOTH);
   gluQuadricOrientation(quadObj, (GLenum) GLU_OUTSIDE);
   AngleAxisr aa(shift);
   glRotatef(aa.angle()*180.0/Mathr::PI,aa.axis()[0],aa.axis()[1],aa.axis()[2]);
   gluCylinder(quadObj, radius, radius, length, glutSlices,glutStacks);
   gluQuadricOrientation(quadObj, (GLenum) GLU_INSIDE);
   glutSolidSphere(radius,glutSlices,glutStacks);
   glTranslatef(0.0,0.0,length);

   glutSolidSphere(radius,glutSlices,glutStacks);
//    gluDisk(quadObj,0.0,radius,glutSlices,_loops);
   gluDeleteQuadric(quadObj);
   glPopMatrix();
}
Esempio n. 20
0
void CALLBACK display(void)
{
	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
	
	glDisable(GL_LIGHTING);
	glColor3f (1, 1, 1);
	for(int j=0;j<8;j++)
	{
		glBegin(GL_LINE_LOOP);
		for (int i = 0; i < 360; i++)
		{
			glVertex3f(cos(i*3.14/180)*r1[j] , 0, sin(i*3.14/180)*r1[j]);
		}
		glEnd();
	}
	glEnable(GL_LIGHTING);
	
	glPushMatrix();
	auxSolidSphere(0.9);
	glPopMatrix();

	glEnable(GL_TEXTURE_2D);	
	for(int i=0;i<8;i++)
	{
		glPushMatrix(); 
		glRotatef(year[i],0,1,0); 	
		glTranslatef( r1[i]  ,0,0);
		glRotatef(day[i],0,1,0);  
		glBindTexture(GL_TEXTURE_2D, texture_id[i]);
		{
			GLUquadricObj*  p = gluNewQuadric();
			gluQuadricTexture (p, GL_TRUE);
			gluSphere(p, r2[i], 16, 16);
			gluDeleteQuadric(p);
		}
		glPopMatrix();
	}	
	glDisable(GL_TEXTURE_2D);
	
	glFlush();
	auxSwapBuffers();	
}
Esempio n. 21
0
void drawBall() {
  glTranslatef(10.0f, 10.0f, 5.5f);
  glRotatef(ballRot, 0, 0, 1);
  glRotatef(20.0f, 1, 0, 0);
  glRotatef(180.0f, 0, 1, 0);
  
  glColor3f(1.0f, 0.0f, 0.0f);
  drawHemisphere(20, 20, 7, true);
  glColor3f(1.0f, 1.0f, 1.0f);
  drawHemisphere(20, 20, 7, false);
    
  glPushMatrix();
    glColor3f(0.0, 0.0, 0.0);   
    glRotatef(90.0f, 1.0, 0.0, 0.0);
    
    GLUquadricObj* ring = gluNewQuadric();
    gluCylinder(ring, 7, 7, 1.5, 100, 10);
    gluDeleteQuadric(ring);
  glPopMatrix();

  glPushMatrix();
    glColor3f(0.0, 0.0, 0.0);
    
    glBegin(GL_POLYGON);
      for (int i = 0; i < 360; i++) {
        float angle = i * RADIAN;
        glVertex3f(cos(angle) * 3, sin(angle) * 3, 7.0f);
      }
    glEnd();
  
    glPushMatrix();
      glColor3f(1.0, 1.0, 1.0);
      
      glBegin(GL_POLYGON);
        for (int i = 0; i < 360; i++) {
          float angle = i * RADIAN;
          glVertex3f(cos(angle) * 2, sin(angle) * 2, 7.5f);
        }
      glEnd();
    glPopMatrix();
  glPopMatrix();
}
Esempio n. 22
0
GLvoid KillGLWindow(GLvoid)								// Properly Kill The Window
{
	gluDeleteQuadric(quadratic);						// Delete The Quadratic To Free System Resources

	if (fullscreen)										// Are We In Fullscreen Mode?
	{
		ChangeDisplaySettings(NULL,0);					// If So Switch Back To The Desktop
		ShowCursor(TRUE);								// Show Mouse Pointer
	}

	if (hRC)											// Do We Have A Rendering Context?
	{
		if (!wglMakeCurrent(NULL,NULL))					// Are We Able To Release The DC And RC Contexts?
		{
			MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
		}

		if (!wglDeleteContext(hRC))						// Are We Able To Delete The RC?
		{
			MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
		}
		hRC=NULL;										// Set RC To NULL
	}

	if (hDC && !ReleaseDC(hWnd,hDC))					// Are We Able To Release The DC
	{
		MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
		hDC=NULL;										// Set DC To NULL
	}

	if (hWnd && !DestroyWindow(hWnd))					// Are We Able To Destroy The Window?
	{
		MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
		hWnd=NULL;										// Set hWnd To NULL
	}

	if (!UnregisterClass("OpenGL",hInstance))			// Are We Able To Unregister Class
	{
		MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
		hInstance=NULL;									// Set hInstance To NULL
	}
}
Esempio n. 23
0
void render_cylinder(GLdouble diameter,const GLdouble p1[3],const GLdouble p2[3],const char *label)
{
	GLdouble v[3],dist,ax,r[3];
	GLUquadricObj *obj;
	int is_z=0;

	v[0]=p2[0]-p1[0];
	v[1]=p2[1]-p1[1];
	v[2]=p2[2]-p1[2];

	dist=sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
	if (dist == 0.0)
		return;

	v[0] /= dist;
	v[1] /= dist;
	v[2] /= dist;

	/* Compute angle and rotation axis */
	ax=180.0/M_PI * acos(p5glove_dot(z_front,v));
	p5glove_plane(z_front,zero,v,r);

	obj=gluNewQuadric();
	gluQuadricDrawStyle(obj,GLU_SMOOTH);
	gluQuadricOrientation(obj,GLU_OUTSIDE);

	/* Fun fun. Draw a cylinder between two points.
	 */
	glPushMatrix();
	glPushMatrix();
	glTranslated(p1[0],p1[1],p1[2]);
	gluSphere(obj,diameter,10,10);
	glRotated(ax, r[0], r[1], r[2]);
	gluCylinder(obj,diameter,diameter,dist,10,1);
	glPopMatrix();
	glTranslated(p2[0],p2[1],p2[2]);
	gluSphere(obj,diameter,10,10);
	render_label(diameter,label);
	glPopMatrix();

	gluDeleteQuadric(obj);
}
void LunarModule::DrawCockpit()
{
    glPushMatrix();
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, texIds[2]);
    
    GLUquadricObj *sphere=NULL;
    sphere = gluNewQuadric();
    gluQuadricDrawStyle(sphere, GLU_FILL);
    gluQuadricTexture(sphere, true);
    gluQuadricNormals(sphere, GLU_SMOOTH);
    glEnable(GL_TEXTURE_2D);
    glRotatef(90, 0, 1, 0);
    gluSphere(sphere, 80, 200, 20);
    
    gluDeleteQuadric(sphere);
    glBindTexture(GL_TEXTURE_2D, NULL);
    glDisable(GL_TEXTURE_2D);
    glPopMatrix();
}
Esempio n. 25
0
//////////////////////////////////////////////////////////////////////////////
//
// Un-initializes textures and quadric(s).
//
//	RETURNS: true,	Always.
//
//////////////////////////////////////////////////////////////////////////////
bool CComaLogo::unInit()
{
	// Remove title image.
	if (m_punTitle != NULL)
		glDeleteTextures(1, m_punTitle), m_punTitle = NULL;

	// Remove shadow image.
	if (m_punBGShadow != NULL)
		glDeleteTextures(1, m_punBGShadow), m_punBGShadow = NULL;

	// Remove background image.
	if (m_punBGTexture != NULL)
		glDeleteTextures(1, m_punBGTexture), m_punBGTexture = NULL;
	
	// Kill the OpenGL quadric sphere.
	if (m_pQuadSphere != NULL)
		gluDeleteQuadric(m_pQuadSphere), m_pQuadSphere = NULL;
	
	return true;
}
Esempio n. 26
0
static void drawPrism(GLdouble radius,V3d Base1Pos,V3d Base2Pos)
{
		V3d Direction;
		double lengt;
		GLUquadricObj *obj;
		glPushMatrix();
		glTranslated(Base1Pos[0],Base1Pos[1],Base1Pos[2]);
		Direction[0] = Base2Pos[0]-Base1Pos[0];
		Direction[1] = Base2Pos[1]-Base1Pos[1];
		Direction[2] = Base2Pos[2]-Base1Pos[2];
		lengt = v3d_length(Direction);

		rotatedVector(Direction);
		obj = gluNewQuadric();
		gluQuadricNormals(obj, GL_SMOOTH);
		gluQuadricDrawStyle(obj, GLU_FILL);
		gluCylinder (obj,radius,radius/5,lengt,10,10);
		gluDeleteQuadric(obj);
		glPopMatrix(); 
}
Esempio n. 27
0
//------------------------------------------------------------------------------
void DrawSphere(GLdouble radius, GLint slices, GLint stacks,
                GLenum style, GLenum orientation, GLenum normals,
                GLenum textureCoords)
{
   GLenum error = glGetError(); 
   GLUquadricObj* qobj = gluNewQuadric();
   error = glGetError(); 
   gluQuadricDrawStyle(qobj, style);
   error = glGetError(); 
   gluQuadricNormals(qobj, normals);
   error = glGetError(); 
   gluQuadricTexture(qobj, textureCoords);
   error = glGetError(); 
   gluSphere(qobj, radius, slices, stacks);
   error = glGetError(); 
   gluQuadricOrientation(qobj, orientation);
   error = glGetError(); 
   gluDeleteQuadric(qobj);
   error = glGetError(); 
}
Cylinder::Cylinder(int slices)
: slices(slices) {
	GLUquadric* quadric = gluNewQuadric();
	gluQuadricTexture(quadric, GL_TRUE);

	idDisplayList = glGenLists(1);
	glNewList(idDisplayList, GL_COMPILE);
//	glRotatef(90.0, 1.0, 0.0, 0.0);
	glTranslatef(0.0, 0.0, -1.0);
	gluCylinder(quadric, 1.0, 1.0, 2.0, slices, 1);
	glTranslatef(0.0, 0.0, 2.0);
	gluDisk(quadric, 0.0, 1.0, slices, 1);
	glTranslatef(0.0, 0.0, -2.0);
	glRotatef(180.0, 1.0, 0.0, 0.0);
	gluDisk(quadric, 0.0, 1.0, slices, 1);
	glEndList();

	gluDeleteQuadric(quadric);

}
Esempio n. 29
0
bool CCubeZoom::unInit()
{ 
	// Kill display list for single object
	if (m_glDispObject != 0)
		glDeleteLists(m_glDispObject,1);

	// Kill display list(s) for recurssion
	if (m_glDispStartIndex != 0)
		glDeleteLists(m_glDispStartIndex, nMAX_CUBE_DEPTH);
	
	// Remove node image.
	if (m_punNodeTexture != NULL)
		glDeleteTextures(1, m_punNodeTexture), m_punNodeTexture = NULL;

	// Kill foreground sphere.
	if (m_pQuadObject != NULL)
		gluDeleteQuadric(m_pQuadObject), m_pQuadObject = NULL;

	return true;
}
Esempio n. 30
0
void Bird::draw() //render
{
    //float angle = getAngle(velocity) + 1.57079633;
    //QQuaternion thisQuat = QQuaternion(position.x(),position.y(),position.z(),0);
    //QQuaternion zeroQuat = (0,0,0,0);
    //QQuaternion = QQuaternion::slerp(thisQuat,zeroQuat);
    glPushMatrix();
    glTranslatef(position.x(),position.y(),position.z());
    glColor3f(1.0,0,1.0);
    //glRotatef();
    //qDebug("drawing1");
    GLUquadricObj *quadric;
    quadric = gluNewQuadric();
    gluQuadricDrawStyle(quadric, GLU_FILL );
    gluSphere(quadric,1,100,100);
    gluDeleteQuadric(quadric);
    glPopMatrix();
    //qDebug("drawing2");

}