[英]What is the correct way to include GLEW in a Mac OS X .framework?
可能是一個非常簡單的問題,但它讓我難住了。
我有一個基於 SDL/OpenGL/GLEW 的 static 庫,它可以編譯 (gcc/g++) 並在 Windows 上正常鏈接。在 OS X 上,相同的代碼庫無法編譯,聲稱它找不到 GL_NUM_EXTENSIONS 和 :: 的聲明glGetStringi() - 這是因為我已經將 GLEW 混入其中(只有 SDL 和 OpenGL,它在 OS X 上也能很好地構建)。
// globals.h
#include <glew.h>
#include <SDL/SDL.h>
// graphics.h
#include "globals.h"
bool HasGLExtension(const char* pName);
// graphics.cpp
#include <string>
#include "graphics.cpp"
bool HasGLExtension(const char* pName)
{
GLint numExtensions;
::glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); // error
for (int i = 0; i < numExtensions; ++i)
{
if (strcmp(pName, (char*)::glGetStringi(GL_EXTENSIONS, i)) == 0) // error
{
return true;
}
}
return false;
}
什么是我失蹤的明顯?
不要這樣做。 對於 1,易於設置,2,開箱即用,3,在許可方面幾乎沒有障礙的東西,請使用glLoadGen 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.