複習:移動,旋轉,縮放
1.自轉,公轉
1.
Google search "freeglut windows"
下載 freeglut 3.0.0 MinGW Package
解壓縮放桌面
在lib複製一個 libfreeglut.a命名為 libglut32.a
開啟codeblocks
File New Project GLUT Project
2.
先把茶壺的程式碼打的main
Google search "freeglut windows"
下載 freeglut 3.0.0 MinGW Package
解壓縮放桌面
在lib複製一個 libfreeglut.a命名為 libglut32.a
開啟codeblocks
File New Project GLUT Project
2.
先把茶壺的程式碼打的main
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc, char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("06161215");
glutDisplayFunc(display);
glutMainLoop();
}
2.改程式碼
#include <GL/glut.h>
float angle=0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0,0.5,0);
glutSolidTeapot(0.3);
glPopMatrix();
glutSwapBuffers();
}
int main(int argc, char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("06161215");
glutDisplayFunc(display);
glutMainLoop();
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc, char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("06161215");
glutDisplayFunc(display);
glutMainLoop();
}
2.改程式碼
#include <GL/glut.h>
float angle=0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0,0.5,0);
glutSolidTeapot(0.3);
glPopMatrix();
glutSwapBuffers();
}
int main(int argc, char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("06161215");
glutDisplayFunc(display);
glutMainLoop();
}
沒有留言:
張貼留言