void snowman() //отрисовка снеговика { glPushMatrix(); double c = 0.9; glColor4d(0.75, 0.75, 0.75, c); glTranslated(0, -3, 0); auxSolidSphere(2.0); glTranslated(0, 3, 0); auxSolidSphere(1.5); glColor4d(0.75, 0.75, 0.75, c); glTranslated(0, 2, 0); auxSolidSphere(1); glColor4d(0, 0, 0, c); glTranslated(-0.3, 0.3, 1); auxSolidSphere(0.1); glTranslated(0.6, 0, 0); auxSolidSphere(0.1); glTranslated(-0.3, -0.3, 0); glColor4d(1, 0, 0, c); auxSolidCone(0.3, 0.5); glTranslated(0, 0.75, -1); glColor4d(0, 0, 1, c); auxSolidCylinder(0.75, 2.); glPopMatrix(); }
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix (); glRotatef (20.0, 1.0, 0.0, 0.0); glPushMatrix (); glTranslatef (-0.75, 0.5, 0.0); glRotatef (90.0, 1.0, 0.0, 0.0); auxSolidTorus (0.275, 0.85); glPopMatrix (); glPushMatrix (); glTranslatef (-0.75, -0.5, 0.0); glRotatef (270.0, 1.0, 0.0, 0.0); auxSolidCone (1.0, 2.0); glPopMatrix (); glPushMatrix (); glTranslatef (0.75, 0.0, -1.0); auxSolidSphere (1.0); glPopMatrix (); glPopMatrix (); glFlush(); }
/************************************************************************************************ * Ball drawing * ************************************************************************************************/ void cBall::Draw() { glPushMatrix(); glTranslatef(this->Pos.x, this->Pos.y, this->Pos.z); glColor3f(1.0f, 1.0f, 1.0f); auxSolidSphere(this->R); glPopMatrix(); }
void draw_man(t_man man) { glPushMatrix(); glColor3f(1.0, 1.0, 0.5); glBegin(GL_POLYGON); /* glVertex3f(man.x - HSX, man.y + HSY, 0); glVertex3f(man.x + HSX, man.y + HSY, 0); glVertex3f(man.x + HSX, man.y - HSY, 0); glVertex3f(man.x - HSX, man.y - HSY, 0);*/ glVertex3f(man.x, man.y + SY, 0); glVertex3f(man.x + SX, man.y + SY, 0); glVertex3f(man.x + SX, man.y, 0); glVertex3f(man.x, man.y, 0); glEnd(); glTranslatef(man.x + HSX, man.y + HSY, 0); if (pole[(int)man.x][(int)man.y+3] != BOX_OFF) { glScalef(1.0, 0.8, 1.0); } if (pole[(int)man.x][(int)man.y+2] != BOX_OFF) { glScalef(1.0, 0.7, 1.0); } if (pole[(int)man.x][(int)man.y+1] != BOX_OFF) { glScalef(1.0, 0.6, 1.0); } auxSolidSphere(0.4); glRotatef(man.ay, 0, 1, 0); glColor3f(0, 0, 0); glTranslatef(-0.1, 0.1, 0.4); auxSolidSphere(0.1); glTranslatef(0.2, 0.0, 0.0); auxSolidSphere(0.1); glPopMatrix(); return; }
void CALLBACK Paint(void) { GLfloat torus_diffuse[]={0.7,0.7,0.0,1.0}; GLfloat cube_diffuse[]={0.0,0.7,0.7,1.0}; GLfloat sphere_diffuse[]={0.7,0.0,0.7,1.0}; GLfloat octa_diffuse[]={0.7,0.4,0.4,1.0}; glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glShadeModel(GL_SMOOTH); glPushMatrix(); glRotatef(3.0,1.0,0.0,0.0); glPushMatrix(); glTranslatef(-0.80,0.35,0.0); glRotatef(100.0,1.0,0.0,0.0); glMaterialfv(GL_FRONT,GL_DIFFUSE,torus_diffuse); auxSolidTorus(0.275,0.85); glPopMatrix(); glPushMatrix(); glTranslatef(-0.75,-0.50,0.0); glRotatef(45.0,0.0,0.0,1.0); glRotatef(45.0,1.0,0.0,0.0); glMaterialfv(GL_FRONT,GL_DIFFUSE,cube_diffuse); auxSolidCube(1.5); glPopMatrix(); glPushMatrix(); glTranslatef(0.75,0.60,0.0); glRotatef(30.0,1.0,0.0,0.0); glMaterialfv(GL_FRONT,GL_DIFFUSE,sphere_diffuse); auxSolidSphere(1.0); glPopMatrix(); glPushMatrix(); glTranslatef(0.70,-0.90,0.25); glMaterialfv(GL_FRONT,GL_DIFFUSE,octa_diffuse); auxSolidOctahedron(1.0); glPopMatrix(); auxCreateFont(); auxDrawStr("OpenGL Auxillary Library"); glPopMatrix(); glFlush(); }
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(); }
void displayObjects(void) { GLfloat torus_diffuse[] = { 0.7, 0.7, 0.0, 1.0 }; GLfloat cube_diffuse[] = { 0.0, 0.7, 0.7, 1.0 }; GLfloat sphere_diffuse[] = { 0.7, 0.0, 0.7, 1.0 }; GLfloat octa_diffuse[] = { 0.7, 0.4, 0.4, 1.0 }; glPushMatrix (); glTranslatef (0.0, 0.0, -5.0); glRotatef (30.0, 1.0, 0.0, 0.0); glPushMatrix (); glTranslatef (-0.80, 0.35, 0.0); glRotatef (100.0, 1.0, 0.0, 0.0); glMaterialfv(GL_FRONT, GL_DIFFUSE, torus_diffuse); auxSolidTorus (0.275, 0.85); glPopMatrix (); glPushMatrix (); glTranslatef (-0.75, -0.50, 0.0); glRotatef (45.0, 0.0, 0.0, 1.0); glRotatef (45.0, 1.0, 0.0, 0.0); glMaterialfv(GL_FRONT, GL_DIFFUSE, cube_diffuse); auxSolidCube (1.5); glPopMatrix (); glPushMatrix (); glTranslatef (0.75, 0.60, 0.0); glRotatef (30.0, 1.0, 0.0, 0.0); glMaterialfv(GL_FRONT, GL_DIFFUSE, sphere_diffuse); auxSolidSphere (1.0); glPopMatrix (); glPushMatrix (); glTranslatef (0.70, -0.90, 0.25); glMaterialfv(GL_FRONT, GL_DIFFUSE, octa_diffuse); auxSolidOctahedron (1.0); glPopMatrix (); glPopMatrix (); }
//创建显示列表******************************************************** void Cab_mfcView::JIQIREN() { //躯干 ::glNewList(1,GL_COMPILE_AND_EXECUTE); glColor3f(.0,0.0,1.0); auxSolidBox(6,8.5,5); ::glEndList(); //胳膊 ::glNewList(2,GL_COMPILE_AND_EXECUTE); glColor3f(0.0,1.0,1.0); auxSolidBox(8,2,1); //auxSolidSphere(1.6); ::glEndList(); //头和脖子 ::glNewList(3,GL_COMPILE_AND_EXECUTE); glColor3f(1.0,1.0,0.0); auxSolidCube((GLdouble) 3); auxSolidBox((GLdouble) 1,(GLdouble) 0,(GLdouble) 1) ;//脖子 ::glEndList(); //腿 ::glNewList(4,GL_COMPILE_AND_EXECUTE); glColor3f(0.0,1.0,.0); auxSolidBox((GLdouble) 2,(GLdouble) 6,(GLdouble) 3) ; ::glEndList(); //眼 ::glNewList(5,GL_COMPILE_AND_EXECUTE); glColor3f(1.0,.0,.0); auxSolidSphere(0.6); ::glEndList(); //嘴 ::glNewList(6,GL_COMPILE_AND_EXECUTE); glColor3f(1.0,0.0,1.0); auxSolidBox(1.5,0.6,0.2); ::glEndList(); }
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); auxSolidSphere(1.0); glFlush(); }
void CALLBACK Paint(void) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); auxSolidSphere(1.0); glFlush(); }
CEE3DINPROC_API void _stdcall CeE3DSolidSphere(GLdouble a) { auxSolidSphere(a); }