點 glVertex2f(X,Y) 2個浮點數
glVertex3f(X,Y,Z)3個浮點數
色彩 glColor3f(r,g,b)
(1)windows解壓縮
將data glut32.dll放入資料夾
開啟 Transformation可改變圖樣及座標位置
(2)
開啟CodeBlocks 專案GLUT
解freeglut壓縮檔
在lib資料夾中複製libfreeglut.a
貼上重新命名為libglut32.a
輸入freeglut資料夾位置網址
#include <GL/glut.h>
void display()
{
glBegin(GL_POLYGON);//GL開始 多邊形
glColor3f(1,1,0);//顏色
glVertex2f(1,1);//座標
glVertex2f(1,0);
glVertex2f(0,0);
glEnd();//GL結束
glutSwapBuffers();
}
int main(int argc, char**argv)
{
glutInit(&argc ,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("hello");
glutDisplayFunc(display);
glutMainLoop();
}
(3)
#include <GL/glut.h>
void display()
{
glBegin(GL_POLYGON);
glColor3f(1,1,0); glVertex2f(1,1);//顏色座標
glColor3f(0,0,1); glVertex2f(1,-1);
glColor3f(1,0,0); glVertex2f(0,0);
glEnd();
glutSwapBuffers();
}
int main(int argc, char**argv)
{
glutInit(&argc ,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("hello");
glutDisplayFunc(display);
glutMainLoop();
}

#include <GL/glut.h>
void display()
{
glBegin(GL_POLYGON);
glColor3f(1,1,0); glVertex2f(1,1);//顏色座標
glColor3f(0,0,1); glVertex2f(1,-1);
glColor3f(1,0,0); glVertex2f(0,0);
glEnd();
glutSwapBuffers();
}
int main(int argc, char**argv)
{
glutInit(&argc ,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("hello");
glutDisplayFunc(display);
glutMainLoop();
}
沒有留言:
張貼留言