问题描述
所以这是个傻瓜;
我有一个相当大的OpenGL解决方案,在Windows 7中以3.2版内核和GLSL 1.5编写.我正在使用GLEW和GLM作为帮助程序库.创建窗口时,使用的是以下几行:
So this one is a doozie;
I've got a pretty large OpenGL solution, written in version 3.2 core with GLSL 1.5 in Windows 7. I am using GLEW and GLM as helper libraries. When I create a window, I am using the following lines:
// Initialize main window
glewExperimental = GL_TRUE;
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); // Use OpenGL Core v3.2
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
if(!glfwOpenWindow(Game::WINDOW_X, Game::WINDOW_Y, 0, 0, 0, 0, 32, 0, GLFW_WINDOW))
{ ...
如果我省略了三个glfwOpenWindowHint函数,则在调用glDrawArrays(GL_TRIANGLES,0,m_numIndices)时,应用程序会使我的视频驱动程序崩溃;
If I omit the three glfwOpenWindowHint functions, the application crashes my video drivers upon call to glDrawArrays(GL_TRIANGLES, 0, m_numIndices);
但是,这是踢脚线.当我小组中的其他人尝试更新并运行解决方案时,他们会得到一个没有几何图形的空白窗口.注释掉三行代码可使该程序正常运行.在使用3.2core提示与不使用3.2core提示之间存在相当大的差异.我无法确定nVidia,AMD,台式机或笔记本电脑之间的任何区别.
But here's the kicker. When someone else in my group tries to update and run the solution, they get a blank window with no geometry. Commenting out the three lines makes the program run fine for them. There is a pretty even split between working with the 3.2core hint and without. I haven't been able to determine any difference between nVidia, AMD, desktop, or laptop.
我能找到的最好的建议是添加glewExperimental = GL_TRUE;因为据说Glew的核心存在问题.没关系.解决方案太大了,无法发布代码,但是我可以根据需要放置着色器,渲染代码等.
The best I could find was a suggestion to add glewExperimental = GL_TRUE; as Glew is said to have problems with core. It made no difference. The solution is too big to post code, but I can put up shaders, rendering code, etc as needed.
非常感谢!这已经使我们丧命了几天.
Thanks so much! This has been killing us for several days now.
推荐答案
尝试询问前向兼容的GLFW窗口:
Try asking for a forward-compatible GLFW window:
并尝试不设置配置文件提示,然后让系统选择:
And try not setting the profile hint and let the system choose:
// Use OpenGL Core v3.2
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
此外,请确保您确实获得了所需的版本:
Also, make sure that you actually get a version you want:
int major, minor, rev;
glfwGetGLVersion(&major, &minor, &rev);
fprintf(stderr, "OpenGL version recieved: %d.%d.%d", major, minor, rev);
不确定是否也可以在Mac上运行,但是请务必阅读以下内容:
Not sure whether you also run for Macs, but read this anyway:
Mac OS X 10.7引入了对OpenGL 3.0及更高版本的支持, 甚至是向前兼容的OpenGL 3.2核心配置文件上下文 支持,并且没有请求调试上下文的机制. Mac OS X的早期版本最多支持OpenGL 2.1.
Support for OpenGL 3.0 and above was introduced with Mac OS X 10.7, and even then forward-compatible OpenGL 3.2 core profile contexts are supported and there is no mechanism for requesting debug contexts. Earlier versions of Mac OS X supports at most OpenGL version 2.1.
因此,在Mac OS X 10.7中,GLFW_OPENGL_VERSION_MAJOR和 如果给定以上版本,则GLFW_OPENGL_VERSION_MINOR提示将失败 3.2,将忽略GLFW_OPENGL_DEBUG_CONTEXT和GLFW_FORWARD_COMPAT提示,并将GLFW_OPENGL_PROFILE提示设置为除 零或GLFW_OPENGL_CORE_PROFILE将导致glfwOpenWindow失败.
Because of this, on Mac OS X 10.7, the GLFW_OPENGL_VERSION_MAJOR and GLFW_OPENGL_VERSION_MINOR hints will fail if given a version above 3.2, the GLFW_OPENGL_DEBUG_CONTEXT and GLFW_FORWARD_COMPAT hints are ignored, and setting the GLFW_OPENGL_PROFILE hint to anything except zero or GLFW_OPENGL_CORE_PROFILE will cause glfwOpenWindow to fail.
此外,在Mac OS X 10.6及更低版本上,GLFW_OPENGL_VERSION_MAJOR和 如果给定以上版本,则GLFW_OPENGL_VERSION_MINOR提示将失败 2.1,GLFW_OPENGL_DEBUG_CONTEXT提示将无效,并将GLFW_OPENGL_PROFILE或GLFW_FORWARD_COMPAT提示设置为 非零值将导致glfwOpenWindow失败.
Also, on Mac OS X 10.6 and below, the GLFW_OPENGL_VERSION_MAJOR and GLFW_OPENGL_VERSION_MINOR hints will fail if given a version above 2.1, the GLFW_OPENGL_DEBUG_CONTEXT hint will have no effect, and setting the GLFW_OPENGL_PROFILE or GLFW_FORWARD_COMPAT hints to a non-zero value will cause glfwOpenWindow to fail.
这篇关于无法部署GLFW 3.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!