在VS中使用freeglut和glew的靜態庫

2021-07-10 11:51:23 字數 1538 閱讀 5631

部落格已轉移至個人**(

首先編譯庫,這兩個庫都有32位和64位版本,並且都發布了靜態庫版本,使用靜態庫就不用再呼叫dll了

glew32s.lib

glew32mxs.lib(多視窗多執行緒版本)

freeglut_static.lib

末尾帶s或直接標明static為靜態版本,需要在程式中鏈結這些庫

其中glew庫不區分debug和release,glut庫區分debug和release,使用時要小心

這裡不要被庫名中的 32 給迷惑了,不論是32位版本還是64位版本,其中都有32  :)

在使用以上二者庫的靜態庫函式的方法是: 在預編譯中新增巨集

glew_static

freeglut_static

或者直接

#define glew_static

#define freeglut_static

#include

#include

對於標頭檔案的說明:

glut提供四個標頭檔案

freeglut.h 就是 freeglut_std.h  &  freeglut_ext.h

glut.h 就是 freeglut_std.h

所以只需要包含freeglut.h就可以了

glew則有三個標頭檔案

glew.h 使用了gl & glu & glext

而glxew.h 包含了 glew.h,同時會呼叫glx的函式

wglew會呼叫wgl的函式

只要包含乙個glew.h標頭檔案,你就能使用gl,glu,glext,wgl,glx

的全部函式,記住將glew的頭放在glut的頭之前哦:)

至於原因嗎:  

一旦程式之前使用了以下頭,一定會報錯

#if defined(__gl_h_) || defined(__gl_h__) || defined(_gl_h) || defined(__x_gl_h)

#error gl.h included before glew.h

#endif

#if defined(__gl2_h_)

#error gl2.h included before glew.h

#endif

#if defined(__gltypes_h_)

#error gltypes.h included before glew.h

#endif

#if defined(__regal_h__)

#error regal.h included before glew.h

#endif

#if defined(__glext_h_) || defined(__glext_h_)

#error glext.h included before glew.h

#endif

#if defined(__gl_ati_h_)

#error glati.h included before glew.h

#endif

在VS中 使用C 訪問Lua

建立vs程式集,然後新增引用luainte ce.dll檔案,選中引用,右鍵新增引用,然後瀏覽到luainte ce.dll的目錄,選擇新增就可以了 而後將luanet.dll檔案複製貼上到,程式集的debug的目錄下,最後建立在vs中使用lua指令碼 我這裡是test.lua檔案 完成情況如圖 u...

在vs2005中使用SkinMagic

對於剛學 vc的朋友來說,介面的設計往往是件頭疼的事,需要編寫許多的 幸好,網上有許多第三方軟體或他人寫好的類能夠為我們所用,其中比較好的一款當數 skinmagic 了。在vs2005 中使用skinmagic 與vc6.0 不太一樣,在此本人在 vs2005 中使用skinmagic 進行初始化...

Qt在VS2010中使用

1 準備兩樣東西 qt win opensource 4.8.5 vs2010 和qt vs addin 1.1.11 opensource 2 安裝 先裝庫,再裝外掛程式 注意 前提是vs2010已經裝好 傻瓜式操作。3 qt預設使用mingw進行編譯,如果要使用vs2010開發,需要將qt重新編...