OpenGL
什麼是OpenGL?
OpenGL環境
安裝 Visual Studio
安裝 cmake
下載 glfw
下載 glad
可透過工具查看最高支援的 opengl 版本
Visual Studio建立C++空白專案
在專案路徑中創建Libraries資料夾
在Libraries中創建lib與include
將glfw解壓縮,並在其中建立build資料夾
打開cmake,設置剛剛的路徑,並按下Configure
選擇你的visual studio版本,並設定為x64
再次按下Configure,然後點擊Generate
進入build資料夾,用visual studio執行GLFW.sln
在方案名稱上點擊右鍵 > 建置方案
將build/src/Debug中產生的glfw3.lib移到你的lib中
將include中的GLFW移到你的include中
將glad解壓縮,其中include中的資料移到你的include
將glad解壓縮,其中include中的資料移到你的include
將glad/src/glad.c直接移到你的專案資料夾
回到你的專案,將上方的x86改為x64
在專案名稱點擊右鍵 > 屬性
屬性頁上方選擇所有平台
左側選擇VC++目錄,並編輯include目錄
加入剛剛建立的include資料夾路徑
編輯程式庫目錄
加入剛剛建立的lib資料夾路徑
左側選擇連結器 > 輸入,並編輯其他相依性
加入glfw3.lib與opengl32.lib
右鍵點擊來源檔案 > 加入 > 現有項目
選擇剛剛加入的glad.c
右鍵點擊來源檔案 > 加入 > 新增項目
創建main.cpp
測試-建立視窗
Double buffer
Render pipeline
Vertex Data
Vertex Buffer Object(VBO)
Linking Vertex Attributes
Vertex shader
Vertex Array Object(VAO)
Shader
Vertex shader
Fragment shader
Compile shaders and link into a program
檢查並輸出 error message
繪製物體
詳細流程
Element Buffer Object(EBO)
0
1
2
3
Reference