vs2013及以上版本opengl環境搭建

2021-08-27 23:43:47 字數 2030 閱讀 6949

由於opengl的大多數實現都是由顯示卡廠商編寫的,當產生乙個bug時通常可以通過公升級顯示卡驅動來解決。這些驅動會包括你的顯示卡能支援的最新版本的opengl,這也是為什麼總是建議你偶爾更新一下顯示卡驅動。

這裡使用的是32位的vs2013庫。

新增目錄(需要vs搜尋庫和include檔案的地方),我們首先進入project properties(工程屬性,在解決方案視窗裡右鍵專案),然後選擇vc++ directories(vc++ 目錄)選項卡(如下圖)。在下面的兩欄新增目錄:

glfw+glew的標頭檔案 新增到 『include directories』

庫目錄(lib檔案) 新增到 『library directories』

windows上的opengl庫

如果你是windows平台,opengl32.lib已經包含在microsoft sdk裡了,它在visual studio安裝的時候就預設安裝了。由於這篇教程用的是vs編譯器,並且是在windows作業系統上,我們只需將opengl32.lib新增進聯結器設定裡就行了。

新建cpp,**如下:

#include // glew  

#define glew_static

//#include "eglew.h"

#include "glew.h"

//#include "glxew.h"

//#include "wglew.h"

// glfw

#include "glfw3.h"

//#include "glfw3native.h"

// function prototypes

void key_callback(glfwwindow* window, int key, int scancode, int action, int mode);

// window dimensions

const gluint width = 800, height = 600;

int main()

glfwmakecontextcurrent(window);

// set the required callback functions

glfwsetkeycallback(window, key_callback);

glewexperimental = gl_true;

// initialize glew to setup the opengl function pointers

if (glewinit() != glew_ok)

// define the viewport dimensions

glviewport(0, 0, width, height);

// game loop

while (!glfwwindowshouldclose(window))

// terminate glfw, clearing any resources allocated by glfw.

glfwterminate();

return 0;

}// is called whenever a key is pressed/released via glfw

void key_callback(glfwwindow* window, int key, int scancode, int action, int mode)

效果圖:

VS2013 金鑰 所有版本

visual studio ultimate 2013 key 金鑰 bwg7x j98b3 w34rt 33b3r jvyw9 visual studio premium 2013 key 金鑰 fbjvc 3cmtx d8dvp rtqct 92494 visual studio profess...

VS2013 產品金鑰 所有版本

visual studio ultimate 2013 key 金鑰 bwg7x j98b3 w34rt 33b3r jvyw9 visual studio premium 2013 key 金鑰 fbjvc 3cmtx d8dvp rtqct 92494 visual studio profess...

vs2013搭建團隊版本控制 TFS SVN

專案使用vs2013開發,之前使用過svn進行版本控制,由於長時間未使用,記錄備用。一.tfs team foundation server tfs 是微軟提供的乙個團隊協同辦公的管理工具,專案總體存在網際網路,各個工作成員通過對各專案檔案的簽出進行編輯,修改後同步伺服器資料,單一檔案的操作許可權是...