OpenGL基本圖形的繪制

OpenGL基本圖形的繪制

ID:40489655

大?。?6.69 KB

頁數(shù):8頁

時間:2019-08-03

OpenGL基本圖形的繪制_第1頁
OpenGL基本圖形的繪制_第2頁
OpenGL基本圖形的繪制_第3頁
OpenGL基本圖形的繪制_第4頁
OpenGL基本圖形的繪制_第5頁
資源描述:

《OpenGL基本圖形的繪制》由會員上傳分享,免費在線閱讀,更多相關內(nèi)容在教育資源-天天文庫。

1、1.使用glColor,glPointSize函數(shù)繪制三個不同顏色和大小的點//T.cpp:Definestheentrypointfortheconsoleapplication.//#include"stdafx.h"#includevoidDisplay(void){glClear(GL_COLOR_BUFFER_BIT);glPointSize(5.0f);glBegin(GL_POINTS);glColor3f(1.0,0.0,0.0);glVertex2f(0.3f,0.5f);glEnd();glPointSize(

2、8.0f);glBegin(GL_POINTS);glColor3f(0.0,1.0,0.0);glVertex2f(0.0f,0.0f);glEnd();glPointSize(10.0f);glBegin(GL_POINTS);glColor3f(0.0,0.0,1.0);glVertex2f(-0.3f,-0.5f);glEnd();glFlush();}intmain(intargc,char*argv[]){glutInit(&argc,argv);glutInitDisplayMode(GLUT_RGB);glutInitWindowPos

3、ition(200,200);glutInitWindowSize(400,400);glutCreateWindow("ThreePoint");glutDisplayFunc(&Display);glutMainLoop();return0;}2.使用glColor,glLineWidth,glLineStripple函數(shù)繪制實心、虛線及漸變色線(1)實心線//T.cpp:Definestheentrypointfortheconsoleapplication.//#include"stdafx.h"#includevoidD

4、isplay(void){glClear(GL_COLOR_BUFFER_BIT);glColor3f(1.0,0.0,0.0);glEnable(GL_LINE_STIPPLE);glShadeModel(GL_SMOOTH);glLineStipple(2,0xFFFF);glLineWidth(2);glBegin(GL_LINES);glVertex2i(-100,0);glVertex2i(100,0);glEnd();glFlush();}intmain(intargc,char*argv[]){glutInit(&argc,argv);g

5、lutInitDisplayMode(GLUT_RGB);glutInitWindowPosition(200,200);glutInitWindowSize(400,400);glutCreateWindow("SolidLine");glutDisplayFunc(&Display);glutMainLoop();return0;}(2)虛線//T.cpp:Definestheentrypointfortheconsoleapplication.//#include"stdafx.h"#includevoidDisplay(v

6、oid){glClear(GL_COLOR_BUFFER_BIT);glColor3f(1.0,0.0,0.0);glEnable(GL_LINE_STIPPLE);glShadeModel(GL_SMOOTH);glLineStipple(4,0xAAAA);glLineWidth(2);glBegin(GL_LINES);glVertex2i(-100,0);glVertex2i(100,0);glEnd();glFlush();}intmain(intargc,char*argv[]){glutInit(&argc,argv);glutInitD

7、isplayMode(GLUT_RGB);glutInitWindowPosition(200,200);glutInitWindowSize(400,400);glutCreateWindow("DottedLine");glutDisplayFunc(&Display);glutMainLoop();return0;}(3)漸變線//T.cpp:Definestheentrypointfortheconsoleapplication.//#include"stdafx.h"#includeGLuintLine;voidInit

8、ial(void){glClearColor(0.0f,0.0f,0.0f,0.0f);Lin

當前文檔最多預覽五頁,下載文檔查看全文

此文檔下載收益歸作者所有

當前文檔最多預覽五頁,下載文檔查看全文
溫馨提示:
1. 部分包含數(shù)學公式或PPT動畫的文件,查看預覽時可能會顯示錯亂或異常,文件下載后無此問題,請放心下載。
2. 本文檔由用戶上傳,版權歸屬用戶,天天文庫負責整理代發(fā)布。如果您對本文檔版權有爭議請及時聯(lián)系客服。
3. 下載前請仔細閱讀文檔內(nèi)容,確認文檔內(nèi)容符合您的需求后進行下載,若出現(xiàn)內(nèi)容與標題不符可向本站投訴處理。
4. 下載文檔時可能由于網(wǎng)絡波動等原因無法下載或下載錯誤,付費完成后未能成功下載的用戶請聯(lián)系客服處理。