茶壺變色
#include <GL/glut.h>
void display()
void display()
{
glColor3f(1,0,0); //顏色
glutSolidTeapot(0.2);
glFlush();
}
glColor3f(1,0,0); //顏色
glutSolidTeapot(0.2);
glFlush();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutCreateWindow("02160154");
glutDisplayFunc(display);
glutMainLoop();
}
glutInit(&argc,argv);
glutCreateWindow("02160154");
glutDisplayFunc(display);
glutMainLoop();
}
多個茶壺通時覆蓋在上面
#include <GL/glut.h>
void display()
{
glClearColor(1,1,0,0); //設定要清畫面的顏色
glClear(GL_COLOR_BUFFER_BIT); //清畫面(動作)
glColor3f(1,1,1);
glutSolidTeapot(0.5);
glColor3f(0,0,1);
glutSolidTeapot(0.4);
glColor3f(1,0,0);
glutSolidTeapot(0.2);
glFlush();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutCreateWindow("02160154");
glutDisplayFunc(display);
glutMainLoop();
}
void display()
{
glClearColor(1,1,0,0); //設定要清畫面的顏色
glClear(GL_COLOR_BUFFER_BIT); //清畫面(動作)
glColor3f(1,1,1);
glutSolidTeapot(0.5);
glColor3f(0,0,1);
glutSolidTeapot(0.4);
glColor3f(1,0,0);
glutSolidTeapot(0.2);
glFlush();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutCreateWindow("02160154");
glutDisplayFunc(display);
glutMainLoop();
}
#include <GL/glut.h>
void display()
{
glClearColor(1,0,0.4,0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,1,0);
glBegin(GL_POLYGON);
glColor3f(0,1,1); //頂點的顏色(也可不寫)
glVertex2f(0.0,0.0); //數值請介於-1.0~1.0
glColor3f(1,0.3,1);
glVertex2f(1.0,0.0);
glColor3f(1,0.7,0.4);
glVertex2f(0.0,1.0);
glEnd();
glFlush();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutCreateWindow("02161052");.
//glutReshapeWindow(800,600); 可調整視窗大小
//glutFullScreen(); 視窗延伸至全螢幕
glutDisplayFunc(display);
glutMainLoop();
void display()
{
glClearColor(1,0,0.4,0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,1,0);
glBegin(GL_POLYGON);
glColor3f(0,1,1); //頂點的顏色(也可不寫)
glVertex2f(0.0,0.0); //數值請介於-1.0~1.0
glColor3f(1,0.3,1);
glVertex2f(1.0,0.0);
glColor3f(1,0.7,0.4);
glVertex2f(0.0,1.0);
glEnd();
glFlush();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutCreateWindow("02161052");.
//glutReshapeWindow(800,600); 可調整視窗大小
//glutFullScreen(); 視窗延伸至全螢幕
glutDisplayFunc(display);
glutMainLoop();
沒有留言:
張貼留言