1.期中模擬考
2.打光
static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glutSolidTeapot(0.3);
glPopMatrix();
glutSwapBuffers();
}
int main(int argc, char *argv[])//裡面刪到只剩下
{
glutDisplayFunc(display);
}
3.茶壺變多個跟茶壺的旋轉
#include <GL/glut.h>
float angle=0;
static void display(void)
{
angle++;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0,0.6,0);
glRotatef(angle,0,1,0);
glutSolidTeapot(0.3);
glPopMatrix();
glPushMatrix();
glutSolidTeapot(0.3);
glPopMatrix();
glutSwapBuffers();
}
int main(int argc, char *argv[])//裡面多加
{
glutIdleFunc(display);
}
4.寫各種形狀
還有
glutSolidTeapot(大小);
glutSolidCube(大小);
glutSolidCone(底r,高h,slice(切),stack堆疊);
glutSolidSphere(r,slice,stack);
glutDedocahedron();
glutIcosahedron();
.
.
.
沒有留言:
張貼留言