Windows7下搭建OpenGL ES3.0開發環境(VS2017)

參考別人的文章:https://blog.csdn.net/brahmsjiang/article/details/78572141,但是這篇文章對編譯過程中出現的各種問題沒有說明,因此特此記錄下。

一、安裝VS2017

(1)下載網址:https://visualstudio.microsoft.com/zh-hans/vs/

(2)安裝過程參考:https://blogs.msdn.microsoft.com/vcblog/2017/04/21/getting-started-with-visual-studio-for-c-and-cpp-development/

 

二、下載《OpenGL ES3.0 Programming guide》示例代碼:

https://codeload.github.com/danginsburg/opengles3-book/zip/master

三、下載mail opengl es模擬器(我也是下載32位的:Mali_OpenGL_ES_Emulator-v3.0.2.g694a9-Windows-32bit):

http://malideveloper.arm.com/resources/tools/opengl-es-emulator/

四、解壓Mali_OpenGL_ES_Emulator-v3.0.2.g694a9-Windows-32bit

(1)將include目錄下的四個文件夾:EGL, GLES2, GLES3, KHR都拷貝到VS2017的安裝路徑下:C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\include

(2)將libEGL.lib,libGLESv2.lib,libMaliEmulator.lib拷貝到:C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\lib\x86

(3)將除去include目錄剩餘的都拷貝到:C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\Hostx86\x86

(4)將libEGL.dll,libGLESv2.dll,libMaliEmulator.dll, openglessl目錄及log4cplus.dll拷貝到C:\Windows\SysWOW64

五、準備工作作完可以開始編譯sample code了

(1)打開VS,新建一個空的工程。將opengles3-book-master\Chapter_2\Hello_Triangle\Hello_Triangle.c和opengles3-book-master\Common目錄拷貝到工程目錄下。並將代碼源文件添加到工程中

(2)將opengles3-book-master\Common\Include目錄添加到附加路徑,點擊項目-》屬性-》C/C++-》通用(General)-》Additional Include Directiories然後編輯添加。如果沒添加路徑會報esUtil.h頭文件找不到的問題。

(3)點擊preprocessor預處理器選項,將";_CRT_SECURE_NO_WARNINGS"字段添加到Preprocessor Definitions裏。否則會出現:fopen: This function or variable may be unsafe......的錯誤。

(4)將C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\lib\x86添加到連接器的lib路徑,否則會報找不到libEGL.lib類似的錯誤。

(5)修改連接器Input附加依賴項,加入libGLESv2.lib;libEGL.lib;libMaliEmulator.lib

(6) 編譯鏈接的時候還可能遇到類似Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file的問題

解決方法:點擊工具-》選項-》Debugging-》Symbols將Microsoft Symbol Servers勾選。

(7)編譯運行,選擇X86,點擊綠色箭頭運行。

運行效果如圖:

最後記錄下學習opengl的網址:

https://learnopengl.com/

https://learnopengl-cn.github.io/

http://nehe.gamedev.net/

https://www.khronos.org/registry/OpenGL-Refpages/es3.0/
————————————————
版權聲明:本文爲CSDN博主「fanchenxinok」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/u010312436/article/details/82984322

發佈了159 篇原創文章 · 獲贊 73 · 訪問量 44萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章