void R3Cone::Draw(void) const { // Draw cone glPushMatrix(); glTranslated(center[0], center[1], center[2]); glRotated(-90, 1, 0, 0); glTranslated(0, 0, -0.5 * height); static GLUquadricObj *glu_cone = gluNewQuadric(); gluQuadricTexture(glu_cone, GL_TRUE); gluQuadricNormals(glu_cone, (GLenum) GLU_SMOOTH); gluQuadricDrawStyle(glu_cone, (GLenum) GLU_FILL); gluQuadricOrientation(glu_cone, (GLenum) GLU_OUTSIDE); gluCylinder(glu_cone, radius, 0, height, 32, 8); gluQuadricOrientation(glu_cone, (GLenum) GLU_INSIDE); gluDisk(glu_cone, 0, radius, 32, 8); glPopMatrix(); }
//============================================================================== void OpenGLRenderInterface::drawCone(double radius, double height) { GLint slices = 16; GLint stacks = 16; // Graphics assumes Cylinder is centered at CoM // gluCylinder places base at z = 0 and top at z = height glTranslated(0.0, 0.0, -0.5*height); // Code taken from glut/lib/glut_shapes.c QUAD_OBJ_INIT; gluQuadricDrawStyle(quadObj, GLU_FILL); gluQuadricNormals(quadObj, GLU_SMOOTH); gluCylinder(quadObj, radius, 0.0, height, slices, stacks); //glut/lib/glut_shapes.c gluDisk(quadObj, 0, radius, slices, stacks); }
void body(GLUquadricObj *quadObj) { glPushMatrix(); glTranslated(0.0, 0.0, -hBody); glEnable(GL_TEXTURE_2D); gluCylinder(quadObj, rBottom, rTop, hBody, 50, 50); glDisable(GL_TEXTURE_2D); glPopMatrix(); glPushMatrix(); glTranslated(0.0, 0.0, -hBody); glRotated(180, 1.0, 0.0, 0.0); glEnable(GL_TEXTURE_2D); gluDisk(quadObj, 0.0, rBottom, 50, 50); glDisable(GL_TEXTURE_2D); glPopMatrix(); }
void glass(GLUquadricObj *quadObj) { glPushAttrib(GL_COLOR_MATERIAL); GLfloat spec[] = { 1.0f, 1.0f, 1.0f, 1.0f }; glVer glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec); glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 128); glColor4f(1, 0.7, 1, 0.3); gluDisk(quadObj, 0, rTop, 50, 50); glPopAttrib(); }
void moCNote::Draw( float note_delay_x, float w_track, float h_track, float inter_line, moEffectState& state ) { glBindTexture( GL_TEXTURE_2D, 0 ); glColor4f( 0, 0, 0, 1 ); GLUquadricObj *quadric; quadric = gluNewQuadric(); gluQuadricDrawStyle(quadric, GLU_FILL); bool bSostenido = false; float dy = ( inter_line / 2.0 ) ; float y = 0.0; moCHeader::HeaderToY( this, inter_line, y, bSostenido); glTranslatef( m_x - ( this->m_tiempo )*( w_track / 2 ) , y , 1.0 ); if (bSostenido) { if (m_pFont) { moText sostxt = "#"; m_pFont->SetForegroundColor( 0.0, 0.0, 0.0 ); m_pFont->SetSize( dy*2 ); m_pFont->Draw( - 2*dy , 0-dy/2, sostxt ); } } if (m_pFont) { m_pFont->SetForegroundColor( 0.0, 0.0, 0.0 ); m_pFont->SetSize( dy*4 ); } glScalef( 1.0, 0.6, 1.0 ); glRotatef( 45, 0.0, 0.0, 1.0 ); int saturation = this->m_velocity; float cr,cg,cb; HSVtoRGB( saturation*2 , 255, 255, &cr, &cg, &cb); glColor4f( cr, cg, cb, 1.0 ); gluDisk( quadric, 0, inter_line / 2.0, 12, 2 ); gluDeleteQuadric(quadric); }
void drawInitialState(int x, int y, float theta){ //glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glColor3ub(63,255,63); glTranslated(x, y, 0); gluDisk(quadric, 0, goalr, 32, 1); glRotated(theta*180/M_PI, 0, 0, 1); glBegin(GL_TRIANGLES); glVertex2f(6, 0); glVertex2f(0, 2); glVertex2f(0, -2); glEnd(); glPopMatrix(); //glFlush(); }
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(); }
////////////////// // OpenGL stuff // ////////////////// int RayCone::drawOpenGL(int materialIndex) { if (material->index != materialIndex) material->drawOpenGL(); glMatrixMode(GL_MODELVIEW); gluCylinder(gluNewQuadric(), radius, 0, height, openGLComplexity, openGLComplexity); GLUquadric* q = gluNewQuadric(); gluQuadricOrientation(q, GLU_INSIDE); gluQuadricDrawStyle(q, GLU_FILL); gluQuadricNormals(q, GLU_SMOOTH); gluDisk(q, 0, radius, openGLComplexity, openGLComplexity); glFlush(); return material->index; }
// OpenGL instructions for drawing a unit disc centered at the origin void Disc::draw(){ // Ghost mode makes it partially transparent double alpha = ghost_? 0.3 : 1.0; glPushMatrix(); glScalef(r_, r_, 1); int res = 24; gluQuadricNormals(quadratic, GLU_SMOOTH); // Create Smooth Normals ( NEW ) gluQuadricTexture(quadratic, GL_TRUE); // Animate the selected disc if (this == spotlight_disc_){ double spot_alpha = .15*sin(8*spotlight_graphic_timer); glColor4f(color_.x,color_.y,color_.z, .23 + spot_alpha); gluDisk(quadratic,1.95f,2.0f,res,res); glColor4f(color_.x,color_.y,color_.z, .1 + spot_alpha); gluDisk(quadratic,1.75f,1.8f,res,res); glColor4f(color_.x,color_.y,color_.z, .08 + spot_alpha); gluDisk(quadratic,1.55f,1.6f,res,res); glColor4f(color_.x,color_.y,color_.z, .04 + spot_alpha); gluDisk(quadratic,1.35f,1.4f,res,res); } glColor4f(color_.x,color_.y,color_.z, alpha); gluCylinder(quadratic,1.0f,1.0f,1.0f,res,res); //Draw the faces gluDisk(quadratic,0.0f,1.0f,res,res); glTranslatef(0,0,1); // Prepare attributes for top face glPushAttrib(GL_ALL_ATTRIB_BITS); if (which_texture_>=0){ glEnable(GL_BLEND); glShadeModel(GL_FLAT); glDepthMask(GL_TRUE); // disable writes to Z-Buffer glDisable(GL_DEPTH_TEST); // disable depth-testing glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glBindTexture(GL_TEXTURE_2D, tex_[which_texture_]); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } // Draw top design gluDisk(quadratic,0.0f,1.0f,res,res); glPopAttrib(); glPopMatrix(); }
void GrainClusterVis::draw() { double t_sec = GTime::instance().sec - startTime ; //cout << t_sec << endl; //if ((g_time -last_gtime) > 50){ glPushMatrix(); glTranslatef((GLfloat)gcX,(GLfloat)gcY,0.0); //Grain cluster representation if (isSelected) glColor4f(0.1,0.7,0.6,0.35); else glColor4f(0.0,0.4,0.7,0.3); selRad = minSelRad + 0.5*(maxSelRad-minSelRad)*sin(2*PI*(freq*t_sec + 0.125)); gluDisk(gluNewQuadric(),selRad, selRad+5.0, 128,2); glPopMatrix(); //update grain motion; //Individual voices //disc version (lower quality, but works on graphics cards that don't support GL_POINT_SMOOTH) // // for (int i = 0; i < numGrains; i++){ // glPushMatrix(); // myGrainsV->at(i)->draw(mode); // glPopMatrix(); // } //end disc version //point version (preferred) glPushMatrix(); //update grain motion; //Individual voices for (int i = 0; i < numGrains; i++){ myGrainsV->at(i)->draw(); } glPopMatrix(); //end point version }
void Pond::display(GLuint marbleTexture,GLuint waterTexture) { if (pond==0) { pond = gluNewQuadric(); gluQuadricNormals(pond, GLU_SMOOTH); gluQuadricTexture (pond,GLU_TRUE); } glPushMatrix(); glLoadName(getName()); glTranslatef(getOrigin().x,getOrigin().y,getOrigin().z); glRotatef(90,1,0,0); glBindTexture(GL_TEXTURE_2D,marbleTexture); gluCylinder(pond,pondRadius,pondRadius+pondRadius*0.1,pondHeight, pondRadius*3,pondRadius*3); glBindTexture(GL_TEXTURE_2D,waterTexture); gluDisk(pond,0,pondRadius,pondRadius*3,pondRadius*3); glPopMatrix(); }
/* 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); } } }
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(); }
void Human::createHipList(){ hipList=glGenLists (1); glNewList(hipList, GL_COMPILE); Texture tex; humanTexture = tex.loadBMP_custom("./images/belt.bmp"); GLUquadricObj *quadratic; quadratic = gluNewQuadric(); glRotatef(90.0f, 1.0f, 0.0f, 0.0f); gluQuadricTexture(quadratic,1); gluCylinder(quadratic,2.1f,2.1f,1.0f,32,32); glPushMatrix(); glTranslatef(0.0,0.0,1.0f); gluDisk(quadratic,0.0f,2.1f,32,32); glPopMatrix(); glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); glEndList(); }
void draw_cone(void) { static GLfloat cone_mat[] = {0.f, .5f, 1.f, .5f}; glPushMatrix(); glTranslatef(0, -1, 0); glRotatef(-90, 1, 0, 0); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, cone_mat); /* base is coplanar with floor, so turn off depth testing */ glDisable(GL_DEPTH_TEST); gluDisk(base, 0., .3, 20, 1); glEnable(GL_DEPTH_TEST); gluCylinder(cone, .3, 0, 1.25, 20, 1); glPopMatrix(); }
void DrawRings() { GLUquadricObj *rings; rings = gluNewQuadric(); gluQuadricDrawStyle(rings, GLU_FILL); //Point normals outwards for lighting gluQuadricOrientation(rings, GLU_OUTSIDE); //Texture the rings gluQuadricTexture(rings, GL_TRUE); glRotated(80, 0, 0, 1); gluDisk(rings, 4.3, 8, 10, 3); return; }
void Human::createLowerLegList(){ lowerLegList=glGenLists (1); glNewList(lowerLegList, GL_COMPILE); Texture tex; humanTexture = tex.loadBMP_custom("./images/trouser.bmp"); glColor3f(0.0f, 1.0f, 0.8f); GLUquadricObj *quadratic; quadratic = gluNewQuadric(); glRotatef(90.0f, 1.0f, 0.0f, 0.0f); gluQuadricTexture(quadratic,1); gluCylinder(quadratic,1.0f,0.8f,6.0f,32,32); glPushMatrix(); glTranslatef(0.0,0.0,6.0f); gluDisk(quadratic,0.0f,0.8f,32,32); glPopMatrix(); glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); glEndList(); }
void Disk::Redraw() { Shape::beginTransform(); material.GLInit(); gluDisk( quadric, 0, 1, 50, 5 ); if( highlight ) { Material::BLACK_PLASTIC.GLInit(); glBegin( GL_LINE_STRIP ); glVertex3f( -1, -1, -.1); glVertex3f( -1, -1, +.1); glVertex3f( -1, +1, +.1); glVertex3f( -1, +1, -.1); glVertex3f( -1, -1, -.1); glVertex3f( +1, -1, -.1); glVertex3f( +1, -1, +.1); glVertex3f( -1, -1, +.1); glEnd(); glBegin( GL_LINE_STRIP ); glVertex3f( +1, -1, -.1); glVertex3f( +1, +1, -.1); glVertex3f( +1, +1, +.1); glVertex3f( -1, +1, +.1); glVertex3f( -1, +1, +.1); glEnd(); glBegin( GL_LINE ); glVertex3f( -1, +1, -.1); glVertex3f( +1, +1, -.1); glVertex3f( +1, -1, +.1); glVertex3f( +1, +1, +.1); glEnd(); } Shape::endTransform(); }
void R3Cone:: Draw(const R3DrawFlags draw_flags) const { #if (RN_3D_GRFX == RN_OPENGL) // Create GLU quadric // Should create GLU quadric for each draw style ??? static GLUquadricObj *cone = gluNewQuadric(); // Push matrix R4Matrix matrix = R4identity_matrix; matrix.Translate(axis.Start().Vector()); matrix.Rotate(R3posz_vector, axis.Vector()); matrix.Push(); // Draw surface if (draw_flags[R3_SURFACES_DRAW_FLAG]) { if (draw_flags[R3_VERTEX_NORMALS_DRAW_FLAG]) gluQuadricNormals(cone, (GLenum) GLU_SMOOTH); else if (draw_flags[R3_SURFACE_NORMALS_DRAW_FLAG]) gluQuadricNormals(cone, (GLenum) GLU_FLAT); if (draw_flags[R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG]) gluQuadricTexture(cone, GL_TRUE); else gluQuadricTexture(cone, GL_FALSE); gluQuadricDrawStyle(cone, (GLenum) GLU_FILL); gluCylinder(cone, Radius(), 0.0, Height(), 16, 1); gluQuadricOrientation(cone, (GLenum) GLU_INSIDE); gluDisk(cone, 0.0, Radius(), 16, 1); gluQuadricOrientation(cone, (GLenum) GLU_OUTSIDE); } // Draw edges if (draw_flags[R3_EDGES_DRAW_FLAG]) { gluQuadricNormals(cone, (GLenum) GLU_NONE); gluQuadricTexture(cone, GL_FALSE); gluQuadricDrawStyle(cone, (GLenum) GLU_SILHOUETTE); gluCylinder(cone, Radius(), 0.0, Height(), 16, 1); } // Pop matrix matrix.Pop(); #else RNAbort("Not Implemented"); #endif }
void ParticleShaderDiskDevelop::drawParticle(int i) { cgGLEnableProfile(vProfile); cgGLEnableProfile(fProfile); cgGLBindProgram(vProgram); bindCGParametersVertex(); bindCGParametersFragment(); cgGLBindProgram(fProgram); GLfloat lightpos[4]; glGetLightfv(GL_LIGHT0, GL_POSITION, lightpos); cgGLSetParameter4fv(lightPositionEC, lightpos); // Pull the diffuse color GLfloat diff[4]; glGetMaterialfv(GL_FRONT, GL_DIFFUSE, diff); // Set the disk center GLfloat dC[3] = {0.0, 0.0, 0.0}; // Get the radius if (radius_data) radius = (*radius_data)[i]; else radius = 1.0; // Set the per-particle Cg parameters cgGLSetParameter3fv(diskCenterWC, dC); cgGLSetParameter4fv(diffuseColor, diff); cgGLSetParameter1f(diskRadius, GLfloat(radius * scale)); cgGLSetStateMatrixParameter(modelViewProj, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY); cgGLSetStateMatrixParameter(modelView, CG_GL_MODELVIEW_MATRIX, CG_GL_MATRIX_IDENTITY); cgGLSetStateMatrixParameter(modelViewIT, CG_GL_MODELVIEW_MATRIX, CG_GL_MATRIX_INVERSE_TRANSPOSE); gluDisk(quad,0,radius*scale*1.51,4,4); cgGLDisableProfile(vProfile); cgGLDisableProfile(fProfile); }
/* draw a 2D buffer stroke in "volumetric" style * NOTE: the stroke buffer doesn't have any coordinate offsets/transforms */ static void gp_draw_stroke_volumetric_buffer(tGPspoint *points, int totpoints, short thickness, short dflag, short UNUSED(sflag)) { GLUquadricObj *qobj = gluNewQuadric(); float modelview[4][4]; tGPspoint *pt; int i; /* error checking */ if ((points == NULL) || (totpoints <= 0)) return; /* check if buffer can be drawn */ if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D)) return; /* get basic matrix - should be camera space (i.e "identity") */ glGetFloatv(GL_MODELVIEW_MATRIX, (float *)modelview); /* draw points */ glPushMatrix(); for (i = 0, pt = points; i < totpoints; i++, pt++) { /* set the transformed position */ // TODO: scale should change based on zoom level, which requires proper translation mult too! modelview[3][0] = pt->x; modelview[3][1] = pt->y; glLoadMatrixf((float *)modelview); /* draw the disk using the current state... */ gluDisk(qobj, 0.0, pt->pressure * thickness, 32, 1); modelview[3][0] = modelview[3][1] = 0.0f; } glPopMatrix(); gluDeleteQuadric(qobj); }
void CGLUtil::init() { _eimModelViewGL.setIdentity(); //_eimModelViewGL(1, 1) = -1.f; //_eimModelViewGL(2, 2) = -1.f; //disk list _uDisk = glGenLists(1); _pQObj = gluNewQuadric(); gluQuadricDrawStyle(_pQObj, GLU_FILL); //LINE); /* wireframe */ gluQuadricNormals(_pQObj, GLU_SMOOTH);// FLAT);// glNewList(_uDisk, GL_COMPILE); gluDisk(_pQObj, 0.0, 0.01, 4, 1);//render a disk on z=0 plane glEndList(); //normal list _uNormal = glGenLists(2); glNewList(_uNormal, GL_COMPILE); glDisable(GL_LIGHTING); glBegin(GL_LINES); glColor3d(1.,1.,1.);// glVertex3d(0.,0.,0.); glVertex3d(0.,0.,0.016); glEnd(); glEndList(); //voxel list _uVoxel = glGenLists(3); glNewList(_uVoxel, GL_COMPILE); glDisable(GL_LIGHTING); renderVoxelGL(1.f); glEndList(); _uOctTree = glGenLists(3); glNewList(_uOctTree, GL_COMPILE); glDisable(GL_LIGHTING); renderOctTree<float>(0,0,0,2,1); glEndList(); glEnable(GL_RESCALE_NORMAL); //init the global light //initLights(); }//init();
void drawBase(GLUquadricObj* qobj, GLuint* tex) { glPushMatrix(); glColor3f(1, 1, 1); glEnable(GL_TEXTURE_2D); glTranslatef(0, -0.6, 0); glRotatef(90, 1, 0, 0); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glBindTexture(GL_TEXTURE_2D, tex[0]); gluDisk(qobj, 0.0, 4.57, 100, 1); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glScalef(3, 1, 1); glMatrixMode(GL_MODELVIEW); glBindTexture(GL_TEXTURE_2D, tex[1]); gluCylinder(qobj, 4.5, 5.5, 2.0, 100, 1); glDisable(GL_TEXTURE_2D); glPopMatrix(); }
void Cone::draw(int complexity){ GLUquadricObj* qobj=gluNewQuadric(); glCallList(material->handle); gluQuadricDrawStyle(qobj, (GLenum)GLU_FILL); gluQuadricOrientation(qobj, (GLenum)GLU_OUTSIDE); gluQuadricNormals(qobj, (GLenum)GLU_SMOOTH); gluQuadricTexture(qobj,GL_TRUE); glPushMatrix(); glTranslated(center[0],center[1]+height/2.0,center[2]); glRotated(90.0,1.0,0,0); gluCylinder( qobj,0.0,radius,height,complexity,complexity); glPushMatrix(); glTranslated(0.0,0.0,height); gluDisk(qobj,0.0,radius,complexity,complexity); glPopMatrix(); glPopMatrix(); gluDeleteQuadric(qobj); }
////////////////// // OpenGL stuff // ////////////////// int RayCone::drawOpenGL(int materialIndex){ if(materialIndex != material->index) material->drawOpenGL(); gluCylinder(gluNewQuadric(), radius, 0, height, openGLComplexity, openGLComplexity); GLUquadricObj *obj = gluNewQuadric(); gluQuadricOrientation(obj, GLU_INSIDE); gluQuadricDrawStyle(obj, GLU_FILL); gluQuadricNormals(obj, GLU_SMOOTH); gluDisk(obj, 0, radius, openGLComplexity, openGLComplexity); //glLoadIdentity(); /*glTranslatef(0.0, 0.0, height); GLUquadricObj *obj2 = gluNewQuadric(); gluQuadricDrawStyle(obj2, GLU_FILL); gluQuadricNormals(obj2, GLU_SMOOTH); gluDisk(obj2, 0, radius, openGLComplexity, openGLComplexity);*/ glFlush();/**/ return material->index; }
void Touche::draw(){ const int slices = 100; const int stacks = 50 ; glPushMatrix(); glTranslated(position_.x,position_.y,position_.z); //DEBUG /* glBegin(GL_LINES); glColor3f(1.0,0.0,0.0); glVertex3f(0.0,0.0,0.0);glVertex3f(100.0,0.0,0.0); glColor3f(0.0,1.0,0.0); glVertex3f(0.0,0.0,0.0);glVertex3f(0.0,100.0,0.0); glColor3f(0.0,0.0,1.0); glVertex3f(0.0,0.0,0.0);glVertex3f(0.0,0.0,100.0); glEnd(); */ glColor3f(color_.r,color_.g,color_.b); glRotated(angleRotation_,0,0,1); glRotated(-inclinaison_,-1,0,0); gluDisk(touche_,0,rayon_,slices,stacks); glPopMatrix(); }
///////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////Draw Stakan!///////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// void Stakan(void) { GLUquadricObj *quarObj; quarObj = gluNewQuadric(); glPushMatrix(); glColor3d(1,0,0); glTranslated(0,-1,0); glRotated(-90,1,0,0); gluQuadricDrawStyle(quarObj,GLU_FILL); gluCylinder(quarObj,0.77,1,2.30,16,1); glPushMatrix(); glRotated(180,1,0,0); gluDisk(quarObj,0,0.77,16,1); glPopMatrix(); glPopMatrix(); gluDeleteQuadric(quarObj); }
void arrows(GLUquadricObj *quadObj) { GLfloat rStick = 0.05; GLfloat height = 0.25; time_t t = time(0); struct tm *cur_time = localtime(&t); GLfloat angle; // hours angle = -(float)cur_time->tm_hour / 12 * 360; glPushMatrix(); glRotatef(angle, 0.0f, 0.0f, 1.0f); arrow_hrs(quadObj); glPopMatrix(); // minutes angle = -(float)cur_time->tm_min / 60 * 360; glPushMatrix(); glRotatef(angle, 0.0f, 0.0f, 1.0f); arrow_min(quadObj); glPopMatrix(); // seconds angle = -(float)cur_time->tm_sec / 60 * 360; glPushMatrix(); glRotatef(angle, 0.0f, 0.0f, 1.0f); arrow_sec(quadObj); glPopMatrix(); // stick glEnable(GL_TEXTURE_2D); gluCylinder(quadObj, rStick, rStick, height, 20, 20); glPushMatrix(); glTranslatef(0.0f, 0.0f, height); gluDisk(quadObj, 0, rStick, 20, 20); glPopMatrix(); glDisable(GL_TEXTURE_2D); }
//------------------------------------------------------------------------------ void DrawConeDL() { GLUquadricObj *gluObject = NULL; gluObject = gluNewQuadric(); gluQuadricDrawStyle (gluObject, GLU_FILL); gluQuadricTexture (gluObject, TRUE); //does not shade nor texture well for a cone, zz debug gluQuadricNormals (gluObject, GLU_SMOOTH); //Making a display list // mysphereID = glGenLists(1); // glNewList(mysphereID, GL_COMPILE); glPushMatrix(); //update to not use a pushMatrix, zz debug glRotatef (180.0f, 0.0f, 0.0f, 1.0f); //orient world texture for coord 0,0 gluCylinder (gluObject, 1.0, 0.0, 2.0, 24, 1); //draw cone glRotatef (180.0f, 1.0f, 0.0f, 0.0f); //flips the disk over gluDisk (gluObject, 0.0, 1.0, 24, 1); //draw bottom disk glPopMatrix(); // glEndList(); // gluDeleteQuadric(sphere); ``````````````//zz debug, should use this }
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glColor3f(1.0, 0.0, 0.0); gluQuadricDrawStyle(theObj,GLU_FILL); // Solid gluSphere(theObj, 20.0, 30, 20); // Sun gluQuadricDrawStyle(theObj,GLU_LINE); // Wire glRotatef(i, 0.0, 1.0, 0.0); glPushMatrix(); //Position A glTranslatef(40.0, 0.0, 0.0); glColor3f(1.0, 1.0, 0.0); glPushMatrix(); //Position B glRotatef(90, 1.0, 0.0, 0.5); gluDisk(theObj, 6.0, 8.0, 50, 2); // Disk glPopMatrix(); //Position B glRotatef(90.0, 1.0, 0.0, 0.0); gluSphere(theObj, 5.0, 50, 20); // Small planet glPopMatrix(); //Position A glPopMatrix(); glutSwapBuffers(); }