GL標誌嘗試設置下面的OpenGL標誌的一種或多種:無法設置與GLFW
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
使得glfwOpenWindow
失敗。爲什麼會這樣?
[編輯]這似乎與主要= 3和MINOR = 2的工作,但 代碼上(的MacBook視網膜Mid2012)運行,可以在筆記本電腦運行到OpenGL的 4.1(英特爾HD 4000有OpenGL 4.0,Nvidia GT 650M有4.1)。 [/編輯]
此外,雖然它可能無關,glfwGetGLVersion
返回0
所有三個參數。
完整的示例代碼如下:
int main(int argc, char * argv[])
{
if(!glfwInit()) {
return EXIT_FAILURE;
}
glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE);
//glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
//glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
//glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
//glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
{
int *major = new int, *minor = new int, *rev = new int;
glfwGetGLVersion(major, minor, rev);
std::cout << *major << " " << *minor << " " << *rev << std::endl;
delete major;
delete minor;
delete rev;
}
if(!glfwOpenWindow(512,512,
8,8,8,
8,24,8,
GLFW_WINDOW)) {
return EXIT_FAILURE;
// APPLICATION EXITS HERE IF ONE OF THE FLAGS ARE SET.
}
while (glfwGetWindowParam(GLFW_OPENED)) {
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers();
}
glfwTerminate();
return 0;
}
MacBook是運行OSX還是其他的東西? – genpfault
http://stackoverflow.com/questions/11964416/mac-os-10-8-supports-glsl-3-30 – Grimmy