石正坤一、实验目的:1
了解OpenGL下简单图形的平移、旋转、缩放变换的编程的基本思想;2
掌握OpenGL下简单图形的平移、旋转、缩放变换的编程的基本步骤;二、实验原理:在OpenGL中,可以使用下面三个函数便捷地实现简单图形平移、旋转、缩放变换的功能:glRotatef(theta,vx,vy,vz);glTranslatef(dx,dy,dz);glScalef(sx,sy,sz);三、实验内容://1
cpp:Definestheentrypointfortheconsoleapplication
//#include"stdafx
h"#include"glut
h"#include"math
h"voiddisplay(){glClear(GL_COLOR_BUFFER_BIT);//CleartheframebufferglColor3f(0
0);//SetcurrentcolortogreenglBegin(GL_POLYGON);//DrawthetriangleglVertex2f(0
2);glVertex2f(0
0);glVertex2f(0
0);glEnd();glFlush();}voiddsp(){glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);//CleartheframebufferglColor3f(0
0);//Setcurrentcolortogreendisplay();//--------------------------//平移glPushMatrix();glTranslatef(0
0);display();glPopMatrix();//--------------------------/