问题
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))
{ ...
If I omit the three glfwOpenWindowHint functions, the application crashes my video drivers upon call to glDrawArrays(GL_TRIANGLES, 0, m_numIndices);
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.
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.
回答1:
Try asking for a forward-compatible GLFW window:
GLFW_OPENGL_FORWARD_COMPAT - Specify whether the OpenGL contextshould be forward-compatible (i.e. disallow legacy functionality). This should only beused when requesting OpenGL version 3.0 or above.
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);
Not sure whether you also run for Macs, but read this anyway:
A.4 OpenGL 3.0+ on Mac OS X
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.
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.
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.
回答2:
I ran into the same issue. I had to create a VAO before my VBO's and now it works on OS X.
GLuint vertex_array;
glGenVertexArrays(1, &vertex_array);
glBindVertexArray(vertex_array);
来源:https://stackoverflow.com/questions/9017023/cannot-deploy-glfw-3-2