void MarillModel::head(GLuint texture){ glPushMatrix(); glColor3f (1.0, 0.0, 5.0); glRotatef(-90.0, 1.0, 0.0, 0.0); glRotatef(15.0, 0.0, 0.0, 1.0); glEnable(GL_TEXTURE_2D); h1 = gluNewQuadric(); gluQuadricNormals(h1, GLU_SMOOTH); gluQuadricTexture(h1, GL_TRUE); glBindTexture(GL_TEXTURE_2D, texture); glScalef(HEAD_HEIGHT_MARILL, HEAD_HEIGHT_MARILL, HEAD_RADIUS_MARILL); gluSphere(h1,1.0,10,10); glDisable(GL_TEXTURE_2D); glPopMatrix(); }
// Draw langit void draw_langit(){ glPushMatrix(); glColor3ub(125, 125, 125); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, langit3); GLUquadricObj* q = gluNewQuadric(); gluQuadricDrawStyle(q, GLU_FILL); gluQuadricNormals(q, GLU_SMOOTH); gluQuadricTexture(q, GL_TRUE); glRotatef(90.0, 1.0, 0.0, 0.0); glScalef(16.0, 16.0, 16.0); gluSphere(q, 1.0, 30, 30); glDisable(GL_TEXTURE_2D); glPopMatrix(); }
void drawboard(void) { int i, j; GLUquadricObj* hole; /* Draw the board */ glColor3f(0.3, 0.3, 1.0); /* Blue */ glShadeModel(GL_FLAT); glBegin(GL_QUADS); for (i=0; i<6; i++) { glNormal3fv(&normals[3*i]); for (j=0; j<4; j++) glVertex3fv(&vertices[3*faces[i*4 + j]]); } glEnd(); /* Draw holes */ glShadeModel(GL_SMOOTH); /* glColor3f(0.0, 0.0, 0.0); */ glPushMatrix(); glTranslatef(-4.0, 0.51, -4.0); for (i=0; i<BOARDSIZE; i++) { glPushMatrix(); for (j=0; j<BOARDSIZE; j++) { if (filled[i][j] == UNUSED) { glTranslatef(1.0, 0.0, 0.0); continue; } glColor3f(0.3, 0.3, 1.0); /* Blue */ glPushMatrix(); glRotatef(-90.0, 1.0, 0.0, 0.0); hole = gluNewQuadric(); gluQuadricDrawStyle(hole, GLU_FILL); gluQuadricNormals(hole, GLU_SMOOTH); gluCylinder(hole, 0.3, 0.3, 0.5, 8, 1); gluDeleteQuadric(hole); glPopMatrix(); glTranslatef(1.0, 0.0, 0.0); } glPopMatrix(); glTranslatef(0.0, 0.0, 1.0); } glPopMatrix(); }
void draw_mercusuar(){ GLUquadricObj *pObj; // Quadric object pObj =gluNewQuadric(); gluQuadricNormals(pObj, GLU_SMOOTH); glPushMatrix(); glTranslatef(-3.0, 3.7, 5.0); glScalef(0.19, 0.19, 0.19); //uppest part glPushMatrix(); glTranslatef(0.0f, 2.50f, 0.0f); glRotatef(-90, 1.0f, 0.0f, 0.0f); glColor3ub(100, 100, 100); gluCylinder(pObj, 2.0f, 0.0f, 2.0f, 26, 1); gluDisk(pObj, 0.0f, 2.0f, 26, 13); glPopMatrix(); //lamp glPushMatrix(); glRotatef(lmRot++, 0.0f, 1.0f, 0.0f); glTranslatef(0.0f, 1.50f, 0.0f); glColor3ub(0, 0, 0); glutSolidCube(2); glTranslatef(0.0f, 0.0f, 1.0f); // Specify new position and direction in rotated coords. glColor3ub(255,255,0); gluSphere(pObj, 1.0f, 26, 13); glPopMatrix(); //upper cube glPushMatrix(); glScalef(1.0f, 0.4f, 1.0f); glColor3ub(100, 100, 100); glutSolidCube(3.5); glPopMatrix(); //cylinder part glPushMatrix(); glTranslatef(0.0f, -20.0f, 0.0f); glRotatef(-90, 1.0f, 0.0f, 0.0f); glColor3ub(0, 0, 0); gluCylinder(pObj, 2.50f, 1.50f, 20.0f, 26, 1); glPopMatrix(); //lowest part glPushMatrix(); glTranslatef(0.0f, -20.0f, 0.0f); glScalef(1.0f, 0.4f, 1.0f); glColor3ub(100, 100, 100); glutSolidCube(5); glPopMatrix(); glPopMatrix(); }
void OpenGLRenderInterface::drawEllipsoid(const Eigen::Vector3d& _size) { glScaled(_size(0), _size(1), _size(2)); GLdouble radius = 0.5; GLint slices = 16; GLint stacks = 16; // Code taken from glut/lib/glut_shapes.c QUAD_OBJ_INIT; gluQuadricDrawStyle(quadObj, GLU_FILL); gluQuadricNormals(quadObj, GLU_SMOOTH); //gluQuadricTexture(quadObj, GL_TRUE); gluSphere(quadObj, radius, slices, stacks); //glut/lib/glut_shapes.c }
void Pcylinder::draw(){ GLUquadricObj *qObj = gluNewQuadric(); gluQuadricNormals(qObj, GLU_SMOOTH); gluQuadricTexture(qObj, GL_TRUE); glEnable(GL_TEXTURE_2D); //base drawCircle(base); //cylinder gluCylinder(qObj, base, top, height, slices, stacks); //top glPushMatrix(); glTranslated(0,0,height); glRotated(180,1,0,0); drawCircle(top); glPopMatrix(); }
void Sphere::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,(GLenum)GL_TRUE); glPushMatrix(); glTranslated(center[0],center[1],center[2]); glRotated(90.0,1.0,0.0,0.0); gluSphere(qobj,radius,complexity,complexity); glPopMatrix(); gluDeleteQuadric(qobj); }
void Cylinder::walk_gl(){ GLUquadricObj* q = gluNewQuadric(); gluQuadricNormals(q, GLU_SMOOTH); gluQuadricTexture(q, GL_TRUE); gluQuadricDrawStyle(q, GLU_FILL); gluCylinder(q,1,1,0.3,20,20); glTranslatef(0.0, 0.0, 0.2); glNormal3f( 0.0f, 1.0f, 0.0f); gluDisk(q, 0.0, 1, 20, 1); glTranslatef(0.0, 0.0, -0.2); gluQuadricOrientation(q, (GLenum)GLU_INSIDE); glNormal3f( 0.0f, -1.0f, 0.0f); gluDisk(q, 0.0, 1, 20, 1); }
/******************************************************************* ** 円柱描画 *******************************************************************/ void OpenGL::DrawSphere(double radius) { // quadric object を一つ生成する */ GLUquadricObj *quad = gluNewQuadric(); // 面の塗り潰しを指定する(線画ではなく陰影をつけた円柱を描く) gluQuadricDrawStyle(quad, GLU_FILL); // スムースシェーディングを行うよう設定する gluQuadricNormals(quad, GLU_SMOOTH); // 球面 gluSphere(quad, (GLdouble)radius, (GLint)16, (GLint)16 ); return; }
static void drawcylinder(coord a, coord b, double width) { double matrix[16]; if (cylqs == NULL) { cylqs = gluNewQuadric(); gluQuadricNormals(cylqs, GLU_SMOOTH); gluQuadricOrientation(cylqs, GLU_OUTSIDE); gluQuadricDrawStyle(cylqs, GLU_FILL);//GLU_SILHOUETTE } glPushMatrix(); glTranslated(a[0], a[1], a[2]); get_matrix(a, b, matrix); glMultMatrixd(matrix); gluCylinder(cylqs, width, width, sqrt((b - a) ^ (b - a)), 4, 2); glPopMatrix(); }
void Cylinder::draw() { /* if (strcmp(cullorder,"CW") == 0) { gluQuadricOrientation(obj, GLU_INSIDE); } else if (strcmp(cullorder,"CCW") == 0) { gluQuadricOrientation(obj, GLU_OUTSIDE); }*/ gluQuadricDrawStyle(obj, GLU_FILL); gluQuadricTexture(obj, GL_TRUE); gluQuadricNormals(obj, GLU_SMOOTH); gluCylinder(obj, (double)data[0], (double)data[1], (double)data[2], (int)data[3], (int)data[4]); }
void GraphicalNode::create() { GLUquadricObj* sphere; mListIndex = glGenLists(1); if (mListIndex != 0) { glNewList(mListIndex,GL_COMPILE); sphere = gluNewQuadric(); gluQuadricDrawStyle(sphere,GLU_TRUE); gluQuadricNormals(sphere,GLU_SMOOTH); gluSphere(sphere,radius,16,16); glEndList(); // Delete the pointer gluDeleteQuadric(sphere); } }
void Spike::makeSpike() { _spikeQuadric = gluNewQuadric(); gluQuadricNormals(_spikeQuadric, GLU_FLAT); gluQuadricOrientation(_spikeQuadric, GLU_INSIDE); _modelSpike = glGenLists(1); assert(_modelSpike != 0); glNewList(_modelSpike,GL_COMPILE); glTranslated(0.1f,0,-0.1f); glRotated(270,1,0,0); gluCylinder(_spikeQuadric,0.1f,0,0.15f,10,10); glEndList(); }
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); }
static void SetupColourPreview(void) { InitGL(0); glClearColor(0.f, 0.f, 0.f, 1.f); qobj = gluNewQuadric(); gluQuadricDrawStyle(qobj, GLU_FILL); gluQuadricNormals(qobj, GLU_FLAT); glViewport(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, (double) STRIP_WIDTH, 0.0, (double) STRIP_HEIGHT, (double) -STRIP_HEIGHT, 0.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }
void SimpleDraw::DrawSpheres( StdVector<Vec3d> & centers, float radius /*= 1.0*/ ) { GLUquadricObj *quadObj = gluNewQuadric(); gluQuadricDrawStyle(quadObj, GLU_FILL); gluQuadricNormals(quadObj, GLU_SMOOTH); for(int i = 0; i < (int)centers.size(); i++) { glPushMatrix(); glTranslatef(centers[i].x(), centers[i].y(), centers[i].z()); gluSphere(quadObj, radius, 16, 16); glPopMatrix(); } gluDeleteQuadric(quadObj); }
// All Setup For OpenGL Goes Here bool CGLLogoView::InitGL() { LoadTextures(); // what color to clear to in color buffer glClearColor(1.0, 1.0, 1.0, 1.0); // Cull backs of polygons glCullFace(GL_BACK); glFrontFace(GL_CCW); glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); glEnable(GL_LINE_SMOOTH); glShadeModel(GL_SMOOTH); // Enable smooth shading glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Enable a single OpenGL light. glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse); glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular); glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); quadric=gluNewQuadric(); gluQuadricNormals(quadric, GLU_SMOOTH); gluQuadricTexture(quadric, GL_TRUE); SetShadowMatrix(fShadowMatrix, LightPosition, Plane); CreateLogo(); CreateGLFont(); return true; }
// un cylindre void Faire_Composantes() { GLUquadricObj* GLAPIENTRY qobj; // attribution des indentificateurs de display lists Ma_Tete = glGenLists(6); Mon_Tronc = Ma_Tete + 1; Mon_Bras = Ma_Tete + 2; Mon_AvantBras = Ma_Tete + 3; Ma_Cuisse = Ma_Tete + 4; Mon_Mollet = Ma_Tete + 5; // compilation de la display list de la sph�re glNewList(Ma_Tete, GL_COMPILE); glutSolidSphere(1.5,8,8); glEndList(); // allocation d�une description de quadrique qobj = gluNewQuadric(); // la quadrique est pleine gluQuadricDrawStyle(qobj, GLU_FILL); // les ombrages, s�il y en a, sont doux gluQuadricNormals(qobj, GLU_SMOOTH); // compilation des display lists des cylindres glNewList(Mon_Tronc, GL_COMPILE); gluCylinder(qobj,2.5,2.5,7.0,100,100); glEndList(); glNewList(Mon_Bras, GL_COMPILE); gluCylinder(qobj,0.5,0.5,5.0,100,100); glEndList(); glNewList(Mon_AvantBras, GL_COMPILE); gluCylinder(qobj,0.5,0.25,5.0,100,100); glEndList(); glNewList(Ma_Cuisse, GL_COMPILE); gluCylinder(qobj,1.25,0.75,5.0,100,100); glEndList(); glNewList(Mon_Mollet, GL_COMPILE); gluCylinder(qobj,0.75,0.25,5.0,100,100); glEndList(); }
void SimpleDraw::DrawCylinder( const Vec3d & center, const Vec3d & direction /*= Vec3d (0,0,1)*/, float height, float radius /*= 1.0f*/, float radius2 /*= -1*/ ) { glPushMatrix(); glTranslatef(center.x(), center.y(), center.z()); glMultMatrixd(qglviewer::Quaternion(qglviewer::Vec(0,0,1), qglviewer::Vec(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(); }
void MarillModel::tail(GLuint texture){ glPushMatrix(); glRotatef(-180.0, 1.0, 1.0, 1.0); //glScalef(FOOT_RADIUS_MARILL, FOOT_HEIGHT_MARILL, FOOT_RADIUS_MARILL); disableShade(); glColor3f(0.1,0.1,0.1); gluCylinder(rllM,0.07, 0.07,TAIL_HEIGHT_MARILL+3.4,10,10); enableShade(); glEnable(GL_TEXTURE_2D); nM = gluNewQuadric(); gluQuadricNormals(nM, GLU_SMOOTH); gluQuadricTexture(nM, GL_TRUE); glBindTexture(GL_TEXTURE_2D, texture); glTranslatef(-0.1, -0.6+NECK_HEIGHT_MARILL+0.5*HEAD_HEIGHT_MARILL-0.4, 6.4); gluSphere(nM,TAIL_RADIUS_MARILL,10,10); glDisable(GL_TEXTURE_2D); glPopMatrix(); }
void gu_drawSphere(float radius, int sliceAndStack, int textured, int normalOutside) { glColor3f(1., 1., 1.); GLUquadric* params = gluNewQuadric(); gluQuadricDrawStyle(params, GLU_FILL); if (!normalOutside) { gluQuadricOrientation(params, GLU_INSIDE); } gluQuadricNormals(params, GLU_SMOOTH); if (textured) { gluQuadricTexture(params, GL_TRUE); } else { gluQuadricTexture(params, GL_FALSE); } gluSphere(params, radius, sliceAndStack, sliceAndStack); gluDeleteQuadric(params); }
void Ball::draw() { glPushMatrix(); glTranslated(-m_location[0],m_location[1],-m_location[2]); if (m_angle[0] != 0 && m_angle[2] != 0) { double t_angle = (m_angle[0]+m_angle[2]); glRotated(t_angle,1.0,0.0,1.0); } else { glRotated(m_angle[0],1.0,0.0,0.0); glRotated(m_angle[2],0.0,0.0,1.0); } glColor3d(0.5, 0.5, 0.5); GLUquadric* quad = gluNewQuadric(); gluQuadricNormals(quad, GLU_SMOOTH); gluQuadricDrawStyle(quad, GLU_FILL); gluQuadricTexture(quad, GL_TRUE); gluSphere(quad, m_radius, 32, 32); glPopMatrix(); }
static void init(void) { int temp; float ballrendersize; body = glGenLists(1); mainball = glGenLists(1); qobj = gluNewQuadric(); gluQuadricNormals(qobj,GLU_SMOOTH); temp = 3; ballrendersize = ballsize - 0.06; if(ballrendersize < 0.01)ballrendersize = ballsize; glNewList(body, GL_COMPILE); //sphere gluSphere(qobj, 0.1, temp, temp); glEndList(); glNewList(mainball, GL_COMPILE); //sphere gluSphere(qobj, ballrendersize * 0.98, 8, 8); glEndList(); }
/*! * Render a cylinder with end caps, along the Z axis centered at 0,0,0 * * Cylinder may be rendered with face culling enabled. */ static void solidCylinder(double r, double h, int slices) { GLUquadricObj *qobj = gluNewQuadric(); gluQuadricDrawStyle(qobj, GLU_FILL); gluQuadricNormals(qobj, GLU_SMOOTH); glPushMatrix(); glTranslated(0., 0., -h/2); gluCylinder( qobj, r, r, h, slices, 1 ); glPushMatrix(); glRotated(180., 1.,0.,0.); gluDisk( qobj, 0., r, slices, 1 ); glPopMatrix(); glTranslated(0., 0., h); gluDisk( qobj, 0., r, slices, 1 ); 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; }
void FXmanga::init(void) { // asignar recursos y tal, cargar ficheros, blabla // Cargo las texturas LoadTGA(&text_oso,"./data/killamala2.tga"); LoadTGA(&text_k,"./data/k.tga"); // setup de la camara cam.SetPos(10,5,10); cam.SetLook(0,0,0.8); cam.setFar(1,100); // quadricas de la muerte this->quad=gluNewQuadric(); gluQuadricNormals(quad, GLU_SMOOTH); gluQuadricTexture(quad, GL_TRUE); }
void Moon::render(void) { glPushMatrix(); // bind the texture glBindTexture(GL_TEXTURE_2D, textureHandle); // translate to the right positon and rotate for the moons spinning glTranslatef(position[0] * distanceScale, position[1] * distanceScale, position[2] * distanceScale); glRotatef(-rotation, 0.0f, 0.0f, 1.0f); // GLU sphere quadric object for the moon GLUquadricObj* quadric = gluNewQuadric(); gluQuadricTexture(quadric, true); gluQuadricNormals(quadric, GLU_SMOOTH); gluSphere(quadric, radius * planetSizeScale, 30, 30); glPopMatrix(); }
void SphereAppearance::assembleAppearances() const { glPushMatrix(); glMultMatrixf(transformation); surface->set(false); GLUquadricObj* q = gluNewQuadric(); gluQuadricNormals(q, GLU_SMOOTH); gluQuadricTexture(q, GL_TRUE); gluSphere(q, radius, 16, 16); gluDeleteQuadric(q); surface->unset(false); GraphicalObject::assembleAppearances(); glPopMatrix(); }
void init(void){ GLfloat luz_ambiente[] = {0.45, 0.45, 0.45, 1.0}; GLfloat luz0_especular[] = {1.0, 1.0, 1.0, 1.0}; GLfloat luz0_difusa[] = {0.35, 0.35, 0.35, 1.0}; GLfloat luz0_posicion[] = {200.0, 200.0, 200.0, 1.0}; GLfloat luz0_direccion[] = {0.0, 0.0, 0.0}; GLUquadricObj *Qflat; glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutInitWindowSize(winWidth, winHeight); glutInitWindowPosition(100, 100); glutCreateWindow("Objeto 3D compuesto"); glColor3f(1.0, 1.0, 1.0); Qflat = gluNewQuadric(); gluQuadricDrawStyle(Qflat, GLU_FILL); gluQuadricNormals(Qflat, GLU_SMOOTH); gluQuadricOrientation(Qflat, GLU_INSIDE); gluQuadricTexture(Qflat, GL_TRUE); ratio=(GLfloat)winWidth/(GLfloat)winHeight; Vx=0.0; Vz=235.0; Vy=30.0; Vtheta=3*PI/2.0; //luz y sombreado glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glLightModelfv(GL_LIGHT_MODEL_AMBIENT,luz_ambiente); glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); glMateriali(GL_FRONT, GL_SHININESS, 60); glLightfv(GL_LIGHT0,GL_DIFFUSE,luz0_difusa); glLightfv(GL_LIGHT0,GL_SPECULAR,luz0_especular); glLightfv(GL_LIGHT0,GL_POSITION,luz0_posicion); glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,luz0_direccion); glEnable(GL_LIGHT0); //lista room Lroom=glGenLists(1); glNewList(Lroom,GL_COMPILE); room(LADO); glEndList(); //lista casa Lcasa=glGenLists(1); glNewList(Lcasa,GL_COMPILE); casa(200); glEndList(); }