/* 바닥에 놓여지는 물건 */ void drawObject(ShapeObject p_obj) { if (p_obj.visible == VISIBLE) { glLoadIdentity(); glTranslatef(p_obj.point[0], p_obj.point[1], p_obj.point[2]); glColor3f(1,1,1); if (p_obj.shape == SHAPE_CUBE) { glutWireCube(p_obj.size[0]); } else if (p_obj.shape == SHAPE_TEAPOT) { glutWireTeapot(p_obj.size[0]); } else { glutWireSphere(p_obj.size[0],15,15); } glColor4f(p_obj.color[0],p_obj.color[1],p_obj.color[2],1); if (p_obj.shape == SHAPE_CUBE) { glutSolidCube(p_obj.size[0]); } else if (p_obj.shape == SHAPE_TEAPOT) { glutSolidTeapot(p_obj.size[0]); } else { glutSolidSphere(p_obj.size[0],15,15); } } }
void renderScene(void) { if (deltaMove) computePos(deltaMove); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt( x, 1.0f, z, x+lx, 1.0f, z+lz, 0.0f, 1.0f, 0.0f); // Draw ground glColor3f(0.9f, 0.9f, 0.9f); glBegin(GL_QUADS); glVertex3f(-100.0f, 0.0f, -100.0f); glVertex3f(-100.0f, 0.0f, 100.0f); glVertex3f( 100.0f, 0.0f, 100.0f); glVertex3f( 100.0f, 0.0f, -100.0f); glEnd(); // Draw 36 Teapot for(i = -3; i < 3; i++) for(j=-3; j < 3; j++) { glPushMatrix(); glTranslatef(i*10.0,0,j * 10.0); glColor3f(0.7, 0.6, 0.0); glScalef(0.5, 0.5, 0.5); glTranslatef(0, 1.0, 0); glutWireTeapot(1.0); glPopMatrix(); } glutSwapBuffers(); }
void display() { glClear(GL_COLOR_BUFFER_BIT); //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f(1,1,1); glLoadIdentity(); //el orden de los angulos sigue sentido horario si avanza en el sentido positivo del eje x y antihorario en caso contrario /* glColor3f(1.0f, 1.0f, 1.0f); // activamos el color blanco glBegin(GL_TRIANGLES); glVertex3f(-1.0f, -1.0f, -1.0f); glVertex3f(1.0f, -1.0f, -1.0f); glVertex3f(0.0f, 1.0f, -1.0f); glEnd(); glColor3f(1.0f, 0.0f, 0.0f); // activamos el color rojo glBegin(GL_QUADS); glVertex3f(-1.0f, -1.0f, -2.0f); glVertex3f(-1.0f, 1.0f, -2.0f); glVertex3f(1.0f, 1.0f, -2.0f); glVertex3f(1.0f, -1.0f, -2.0f); glEnd(); */ //glRotatef(60, 0.0f, 1.0f, 0.0f); //glutWireSphere(1.0,40,20); //glutSolidSphere(1.0,40,20); glutSolidCube(0.3); //glutWireCube(2.0); //glutSolidTorus(0.3,1.0,50,50); //glutWireTorus(0.2,0.5,50,50); //glutWireCone(1.0,2.0,50,50); glutWireTeapot(0.5f); glFlush(); //si esta linea esta comentada solo se muestra una ventana transparente ya que no se vuelca el buffer de escritura en el de visualización }
// 3Dオブジェクトを描画(引数によって変化) void mySelectWire(int i){ switch(i){ case 0: glutWireSphere( 30.0, 10, 10); break; case 1: glutWireCube( 40.0 ); break; case 2: glScalef( 1.5, 1.5, 1.5 ); glutWireTorus( 10.0, 20.0, 20, 6); break; case 3: glScalef( 40.0, 40.0, 40.0 ); glutWireTetrahedron(); break; case 4: glTranslatef( 0.0, 0.0, 10.0 ); glRotatef( 90.0, 1.0, 0.0, 0.0 ); glutWireTeapot( 40.0 ); break; default: glutWireIcosahedron(); printf("EROOR: Wire_count\n"); break; } }
void glut_display(void) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(30.0,1.0,0.1,100); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(Distance * cos(Angle2) * sin(Angle1), Distance * sin(Angle2), Distance * cos(Angle2) * cos(Angle1), 0.0,0.0,0.0,0.0,1.0,0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glPushMatrix(); glTranslatef(-1.0,3.0,0.0); glRotatef(-30,0.0,0.0,1.0); glColor3f(1.0,1.0,1.0); glutWireTeapot(1.0); glPopMatrix(); glPushMatrix(); glTranslatef(0.0,-2.0,0.0); draw_pyramid(); glPopMatrix(); glFlush(); glDisable(GL_DEPTH_TEST); glutSwapBuffers(); }
void display(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f(153/255.0, 76/255.0, 0.0f); glPushMatrix(); glutWireCube(0.75); glPopMatrix(); glPushMatrix(); glTranslatef(0.0,0.75, 0.0); glutWireCube(0.75); glPopMatrix(); glPushMatrix(); glTranslatef(0.0, 1.25, 0.0); glRotatef(-65.0, 1.0, 0.0, 0.0); glColor3f(0.0f, 1.0f, 0.0f); glutWireCone(1.0, 1.2, 20, 20); glPopMatrix(); glPushMatrix(); glColor3f(1.0f, 0.0f, 0.0f); glTranslatef(0.90, 0.0, 0.0); glRotatef(-180, 1.0, 0.0, 0.0); glutWireTeapot(0.25); glPopMatrix(); glutSwapBuffers(); }
void display (void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear display window. glEnable (GL_LINE_SMOOTH); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); switch (color) { case 1: glColor3f (1.0, 0.0, 0.0); break; // Set color to red case 2: glColor3f (0.0, 1.0, 0.0); break; // Set color to green case 3: glColor3f (0.0, 0.0, 1.0); break; // Set color to blue case 4: glColor3f (0.0, 0.0, 0.0); break; // Set color to black } switch (shape) { case 1 : glutWireTorus (5, 20, 10, 10); break; // Draw wireTorus case 2 : glutWireSphere (30, 50, 20); break; // Draw wireSphere case 3 : glutWireTeapot (25); break; // Draw wireTeapot } glutSwapBuffers(); glFlush ( ); }
void display(void){ glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0,0,0); glutWireTeapot(3); glFlush(); return; }
static void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Clear Color and Depth glPushMatrix(); // Begin drawing image glRotatef( x,0.0,1.0,0.0); // Rotate glColor3f(1.0,0.0, 0.0); // Set Drawing Color to Red glutWireTorus(0.4,0.7,30,20); // Draw glutWireTorus(innerRadius, outerRadius, nsides, rings); glPushMatrix(); // Draw orbiting sphere glTranslatef(0.5,0.0,-1.0); // Move away from origin glColor3f(1.0,1.0,0.0); // Set color to yellow glutWireSphere(0.3,20,16); // Draw Sphere glPushMatrix(); // Draw glutWireTeapot orbiting around the sphere glRotatef( x, 0.0, 1.0, 0.0); // Rotate glTranslatef(0.3,0.0,-0.5); // Move reference point glColor3f(0.0,0.0,1.0); // Color Blue glutWireTeapot(0.2); // Draw teapot glPopMatrix(); // Return to former reference glPopMatrix(); // Return to first refernce glPushMatrix(); // Draw orbiting cone glTranslatef(-0.5,0.0,1.0); // Move reference poit glColor3f(0.0,1.0,0.0); // Set color to green glutWireCone(0.3,0.5,20,16); // Draw cone glPopMatrix(); // Return to first reference glPopMatrix(); // Return to base reference glFlush(); // Flush drawing routines glutSwapBuffers(); // Swap buffers }
void display(void) { glClear (GL_COLOR_BUFFER_BIT); glLoadIdentity (); gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glTranslatef(tx*5.0, ty*5.0, 0.0); glRotatef(r, 1, 0, 0); glRotatef(r, 0, 1, 0); glRotatef(r, 0, 0, 1); switch (object) { case 0: glColor3f (0.0, 1.0, 0.0); glutWireCube(2.0); break; case 1: glColor3f (0.0, 1.0, 1.0); glutWireDodecahedron(); break; case 2: glColor3f (1.0, 0.0, 0.0); glutWireIcosahedron(); break; case 3: glColor3f (1.0, 1.0, 0.0); glutWireTeapot(1.5); break; } glutSwapBuffers(); }
void Primitive::draw() const { glPopMatrix(); glColor3f(red, green, blue); { // Sphere //if ( m_type == Primitive::kSphere && style == Renderable::kWireframe ) // glutWireSphere(size); //else if ( m_type == Primitive::kSphere && style == Renderable::kShaded ) // glutSolidSphere(size); // Cube if ( m_type == Primitive::kCube && style == Renderable::kWireframe ) glutWireCube(size); else if ( m_type == Primitive::kCube && style == Renderable::kShaded ) glutSolidCube(size); // Torus //else if ( m_type == Primitive::kTorus && style == Renderable::kWireframe ) // glutWireTorus(size); //else if ( m_type == Primitive::kTorus && style == Renderable::kShaded ) // glutSolidTorus(size); // Teapot else if ( m_type == Primitive::kTeapot && style == Renderable::kWireframe ) glutWireTeapot(size); else if ( m_type == Primitive::kTeapot && style == Renderable::kShaded ) glutSolidTeapot(size); } glPopMatrix(); };
//<<<<<<<<<<<<<<<<<<<<<<< myDisplay >>>>>>>>>>>>>>>>>>>>>>>>>> void myDisplay(void) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glColor3f(0.0f,0.0f,0.0f); // set color of stuff glutWireTeapot(1.0); // draw the teapot glutSwapBuffers(); // display the screen just made }
// // To display onto window using OpenGL commands // void display() { glClearColor( 0, 0 , 0 , 0 ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glLoadIdentity(); cam1.LookAt() ; glColor3f(1,1,0); glPushMatrix(); glTranslatef( (current-1) * 5, 2, -10) ; glScalef(0.2, 0.2, 0.2) ; WireArrow() ; glPopMatrix(); glColor3f( colors[0].r, colors[0].g, colors[0].b ); glPushMatrix(); glTranslatef(-5, 0, -10) ; glScalef( size[0], size[0], size[0] ); glutWireTeapot(1) ; glPopMatrix(); glColor3f( colors[1].r, colors[1].g, colors[1].b ); glPushMatrix(); glTranslatef(0, 0, -10) ; glRotatef( 45, 1,1,1 ) ; glScalef( size[1], size[1], size[1] ); glutWireCube(1.5) ; glPopMatrix(); glColor3f( colors[2].r, colors[2].g, colors[2].b ); glPushMatrix(); glTranslatef(5, 0, -10) ; glScalef( size[2], size[2], size[2] ); glutWireCone(1, 1, 10, 10) ; glPopMatrix(); glColor3f(1,1,1); // Text Part glPushMatrix(); glTranslatef(-6, -2, -10) ; vprint2(0,0, 0.005, "Teapot"); glPopMatrix(); glPushMatrix(); glTranslatef(-1, -2, -10) ; vprint2(0,0, 0.005, "Cube"); glPopMatrix(); glPushMatrix(); glTranslatef(4.5, -2, -10) ; vprint2(0,0, 0.005, "Cone"); glPopMatrix(); glutSwapBuffers(); }
static void hugsprim_glutWireTeapot_17(HugsStackPtr hugs_root) { HsDouble arg1; arg1 = hugs->getDouble(); glutWireTeapot(arg1); hugs->returnIO(hugs_root,0); }
void myGlutDisplay( void ) { glClearColor( .9f, .9f, .9f, 1.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glFrustum( -xy_aspect*.08, xy_aspect*.08, -.08, .08, .1, 15.0 ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( 0.0, 0.0, -1.2f ); glRotatef( rotationY, 0.0, 1.0, 0.0 ); glRotatef( rotationX, 1.0, 0.0, 0.0 ); glScalef( scale, scale, scale ); /*** Now we render object, using the variables 'obj_type', 'segments', and 'wireframe'. These are _live_ variables, which are transparently updated by GLUI ***/ if ( obj_type == 0 ) { if ( wireframe ) glutWireSphere( .6, segments, segments ); else glutSolidSphere( .6, segments, segments ); } else if ( obj_type == 1 ) { if ( wireframe ) glutWireTorus( .2,.5,16,segments ); else glutSolidTorus( .2,.5,16,segments ); } else if ( obj_type == 2 ) { if ( wireframe ) glutWireTeapot( .5 ); else glutSolidTeapot( .5 ); } /* Disable lighting and set up ortho projection to render text */ glDisable( GL_LIGHTING ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluOrtho2D( 0.0, 100.0, 0.0, 100.0 ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glColor3ub( 0, 0, 0 ); glRasterPos2i( 10, 10 ); /*** Render the live character array 'text' ***/ for (unsigned int i=0; i<text.length(); ++i) glutBitmapCharacter( GLUT_BITMAP_HELVETICA_18, text[i] ); glEnable( GL_LIGHTING ); glutSwapBuffers(); }
static void drawWireTeapot(void) { /* per Glut manpage, it should be noted that the teapot is rendered * with clockwise winding for front facing polygons... */ glFrontFace(GL_CW); glutWireTeapot(orad); /* orad doubles as size input */ glFrontFace(GL_CCW); }
/* bit of a silly one, this */ void seed_teapot(void) { glLoadIdentity(); glTranslatef((frand() - 0.5) * seedsize, (frand() - 0.5) * seedsize, 0.0); glRotatef(frand() * 360.0, frand(), frand(), frand()); set_colour(); glutWireTeapot(seedsize); }
void GraphicsScene(void) // this is created by shyeo, isolating the gl routines only from GraphicsDisplay { int attr; static matrix posn; // Display text. strncpy(GraphicsString, StateText[StateGraphics], STRLEN); GraphicsDisplayText(); // Display rotating teapot during rest period. if (StateGraphics == STATE_REST) { glPushMatrix(); GRAPHICS_ColorSet(GREEN); glRotated(ExperimentTimer.ElapsedSeconds() * 10.0 * PI, 1.0, 1.0, 1.0); glutWireTeapot(10.0); glPopMatrix(); return; } // Display home position at start of trial. if ((StateGraphics >= STATE_SETUP) && (StateGraphics <= STATE_MOVING)) { attr = RobotHome() ? HomeColor : NotHomeColor; //GRAPHICS_Circle(&StartPosition, HomeRadius, attr); GRAPHICS_Sphere(&StartPosition, HomeRadius, attr); } // Display target spheres when trial running. if ((StateGraphics >= STATE_GO) && (StateGraphics <= STATE_FINISH)) { // Display target for movement. GRAPHICS_Sphere(&TargetPosition, TargetRadius, TargetColor); // Display graphics sync target for phototransistor. if (!GraphicsSyncPosition.iszero()) { GRAPHICS_Sphere(&GraphicsSyncPosition, GraphicsSyncRadius, GraphicsSyncColor); } } // Display finish position. if ((StateGraphics > STATE_MOVING) && (StateGraphics <= STATE_INTERTRIAL)) { attr = RobotHome() ? HomeColor : NotHomeColor; GRAPHICS_Sphere(&FinishPosition, HomeRadius, attr); } // Display robot position cursor. if ((StateGraphics != STATE_ERROR) && (VisualFeedback || RobotHome())) { posn = CursorPosition; posn(3, 1) += 2.0*HomeRadius; GRAPHICS_Sphere(&posn, CursorRadius, CursorColor); } }
void RenderScene2() { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glColor3f(1.0, 0.5, 0.2); // Set drawing colour = orange glutWireTeapot(20.0); }
void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); //gluLookAt(1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, sin(angle/SMALLSTEPD), cos(angle/SMALLSTEPD)); glPushMatrix(); glTranslatef(0.0f, 0.0f, -4.0f); glRotatef(angle, 5.0f, 7.0f, 11.0f); glutWireTeapot(1.0f); glPopMatrix(); glPushMatrix(); glTranslatef(3.0f*sin(180.0f+angle/SMALLSTEPD), 3.0f*cos(180.0f+angle/SMALLSTEPD), -4.0f); glRotatef(angle, -17.0f, 19.0f, -13.0f); glutWireTeapot(0.3f); glPopMatrix(); glPushMatrix(); glTranslatef(3.0f*sin(90.0f+angle/SMALLSTEPD), 3.0f*cos(90.0f+angle/SMALLSTEPD), -4.0f); glRotatef(angle, -17.0f, 19.0f, -13.0f); glutWireTeapot(0.3f); glPopMatrix(); glPushMatrix(); glTranslatef(3.0f*sin(angle/SMALLSTEPD), 3.0f*cos(angle/SMALLSTEPD), -4.0f); glRotatef(angle, -17.0f, 19.0f, -13.0f); glutWireTeapot(0.3f); glPopMatrix(); glPushMatrix(); glTranslatef(0.0f, 0.0f, -4.0f); glRotatef(3.0f*angle, 1.0f, 0.0f, 0.0f); glutWireTorus(1.0f, 4.0f, 36.0f, 36.0f); glPopMatrix(); glFinish(); glutSwapBuffers(); }
void display(void) { double t; // glClear(GL_COLOR_BUFFER_BIT); // clear the screen glColor3f(0.0,0.0,0.0); // glutWireTeapot(1.0); // glutSwapBuffers(); }
// Função callback chamada para fazer o desenho void Desenha(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.0f, 0.0f, 1.0f); // Desenha o teapot com a cor corrente (wire-frame) glutWireTeapot(50.0f); // Executa os comandos OpenGL glutSwapBuffers(); }
/** WireTeapot (size) -> none */ static int glut_wire_teapot(lua_State *L) { /* test argument type */ if (lua_isnumber(L, 1)) { /* call GLUT functions */ glutWireTeapot((GLdouble)lua_tonumber(L, 1)); } else { luaL_error(L, "incorrect argument to function 'glut.WireTeapot'"); } return 0; }
void renderWorld() { static double r = 0; glPushMatrix(); glTranslatef(0.0f,0.0f,0.0f); glPushMatrix(); glRotatef(r, 0.,1.,0.); glColor3f(1.0,0.0,0.0); glutWireTeapot(0.05f); glPopMatrix(); glPopMatrix(); //r += 0.1; }
void display() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.0,1.0,0.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(width/2,height/2,0); glRotatef( 25, 1, 0, 0 ); glutWireTeapot(width/4); glFlush(); }
void Desenha_carro (void) { glutWireTeapot(50); // glBegin (GL_QUADS); //glVertex2f (c0.x+c1.x,c0.y+c1.y); //glVertex2f (c0.x+c2.x,c0.y+c2.y); // glVertex2f (c0.x+c3.x,c0.y+c3.y); // glVertex2f (c0.x+c4.x,c0.y+c4.y); // glEnd(); // glFlush(); }
void display() { // Funcion que atiende al evento de display (render) // Color de borrado (1er paso para pintar) glClearColor(1.0,1.0,1.0,1.0); //RGBA, 30% azul // Borra la pantalla y buffer de profundidad glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Inicializa matriz compuesta de la MV glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Situo y oriento la camara gluLookAt(1,3,5, 0,0,0, 0,1,0);// miramos al origen de coordenadas con la vertical eje y ejes(); // ver ejes glRotatef(girox, 1, 0, 0); glRotatef(giroy, 0, 1, 0); if(modo == ALAMBRICO){ glColor3f(1,1,0); glutWireTeapot(0.51); } else if (modo == SOLIDO){ glColor3f(1,0,0); glutSolidTeapot(0.5); } else{ glColor3f(1,0,0); glutSolidTeapot(0.5); glColor3f(1,1,0); glutWireTeapot(0.51); } // Intercambio los buffers glutSwapBuffers(); }
void Display () { // kolor t³a - zawartoœæ bufora koloru glClearColor (0.8,0.8,0.8,0.0); // czyszczenie bufora koloru glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); //glOrtho(-1, 1, -1, 1, 0, 2); glFrustum(-1, 1, -1, 1, 3, 8); //gluLookAt(0.1, 0.2, -3, 0, 0, -8, 0, 1, 0); glBegin(GL_POLYGON); glColor3f(0.1, 0.8, 0.1); glVertex3f(-0.4, 0.4, -4); glVertex3f(0.2, 0.4, -4); glVertex3f(0.2, -0.4, -4); glVertex3f(-0.4, -0.4, -4); glEnd(); glBegin(GL_POLYGON); glColor3f(0.1, 0.1, 0.8); glVertex3f(0.2, 0.4, -4); glVertex3f(0.4, 0.4, -5.5); glVertex3f(0.4, -0.4, -5.5); glVertex3f(0.2, -0.4, -4); glEnd(); glBegin(GL_POLYGON); glColor3f(0.8, 0.1, 0.1); glVertex3f(-0.8, 0.7, -5); glVertex3f(-0.3, 0.7, -6); glVertex3f(-0.3, -0.3, -6); glVertex3f(-0.8, -0.3, -5); glEnd(); glutWireCube(5); glutWireTeapot(3.2); glutWireSphere(4, 3, 3); // skierowanie poleceñ do wykonania glFlush (); // zamiana buforów koloru glutSwapBuffers(); }
void displayCB() { angle += 1.225; // adjust viewport and projection matrix to texture dimension glViewport(0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0f, (float)(TEXTURE_WIDTH)/TEXTURE_HEIGHT, 1.0f, 100.0f); glMatrixMode(GL_MODELVIEW); // camera transform glLoadIdentity(); glTranslatef(0, 0, -CAMERA_DISTANCE); // render directly to a texture // set the rendering destination to FBO glBindFramebuffer(GL_FRAMEBUFFER, fboId); // clear buffer glClearColor(0, 0, 1, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // draw a rotating teapot at the origin glPushMatrix(); glRotatef(angle, 0, 1, 0); glutWireTeapot(2.0f); glPopMatrix(); glBindFramebuffer(GL_FRAMEBUFFER, 0); // back to normal viewport and projection matrix glViewport(0, 0, screenWidth, screenHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0f, (float)(screenWidth)/screenHeight, 1.0f, 1000.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // tramsform camera glTranslatef(0, 0, -cameraDistance); // clear framebuffer glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glPushMatrix(); // draw a cube with the dynamic texture draw(); glPopMatrix(); glutSwapBuffers(); glutPostRedisplay(); }
void DisplayHandler(void) { // Clear the screen glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // Push to save the current matrix glPushMatrix(); glTranslatef(0, 0, -5.0); // Display glColor3f(0.0f, 1.0f, 0.0f ); glutWireTeapot(1.0); // Pop to recover glPopMatrix(); glutSwapBuffers(); }