case1
下載 sources.zip 不用解windows.zip 解壓 >下載>windows> Light Material.exe
data.zip 解壓>下載>windows>data>模型
glut32.dll 解壓 >下載 >windows>glut32.dll
data 跟 glut32.dll 拉進 windows> 完成
case2
立體茶壺 ~~~~~~~~~~~~
#include <GL/glut.h>
const GLfloat light_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f }; const GLfloat light_diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f }; const GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f }; const GLfloat light_position[] = { 2.0f, 5.0f, 5.0f, 0.0f }; const GLfloat mat_ambient[] = { 0.7f, 0.7f, 0.7f, 1.0f }; const GLfloat mat_diffuse[] = { 0.8f, 0.8f, 0.8f, 1.0f }; const GLfloat mat_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f }; const GLfloat high_shininess[] = { 100.0f }; 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("06161110_Week06!!"); glutDisplayFunc(display); glClearColor(1,1,1,1); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glEnable(GL_LIGHT0); glEnable(GL_NORMALIZE); glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHTING); glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); glLightfv(GL_LIGHT0, GL_POSITION, light_position); glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess); glutMainLoop(); }case3
開啟source.zip 壓縮檔的 transformation.c
找到下面兩段程式碼
貼'上
下載先下面兩個檔案 貼到codeblocks 資料夾裡
把glm.c 附檔名改成cpp
加入到
再將之前下載好的data資料夾
加入到freeglut/bin 裡
執行成功~~~~
紅框為3D圖檔
沒有留言:
張貼留言