1-1下載win32的example範例
https://jsyeh.org/3dcg10
windows.zip 下載\windows\Shape.exe執行
glBegin(GL_POLYGON) 開始畫
glVertex3f(x,y,z) 頂點 Vertex
glColor3f(r,g,b)色彩 Color
glEnd()
1-3
File-New-Project選glut檔名為week03_color專案存在桌面
glVertex3f(x,y,z) 頂點 Vertex
glColor3f(r,g,b)色彩 Color
glEnd()
1-3
刪除所有程式碼更改為
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(1,1,0);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("week03的視窗");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
1-4
建立File-New-Project選glut專案檔名為week03_color_triangle存在桌面
更改程式碼
glColor3f(1.0f, 0.0f, 0.0f); glVertex2f(0.0f, 1.0f);
glColor3f(0.0f, 1.0f, 0.0f); glVertex2f(0.87f, -0.5f);
glColor3f(0.0f, 0.0f, 1.0f); glVertex2f(-0.87f, -0.5f);
沒有留言:
張貼留言