Cannot deploy GLFW 3.2
Asked Answered
A

2

6

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.

Ables answered 26/1, 2012 at 10:49 Comment(6)
Nope. GLFW is by far the easiest windowing solution, but it is not reliable at all. By disabling crossfire on my computer I can get it to run most of the time. Still will not run on the nVidia machines in our lab. I contacted the GLFW guys on IRC, and they only have one Windows developer. His answer was "I dunno." I made an attempt to move over to SDL, but that wouldn't create a 3.X context on one of our machines at all. Still using GLFW, just unreliably.Ables
Can you link to an example which behaves unreliably? It's just that I set up GLFW+GL3W on an AMD Llano 3650 yesterday (following the hints in nightcracker's answer), and while the rudimentary example is 100% ok, would like to know of possible stumbling points.Krill
Here is the original code that prompted this question: link However, it seems that after disabling crossfire and applying nightcracker's fix, it works reliably. I never committed the code that removed the 3.2core request, so I never tried it after disabling crossfire. Looks like that actually solves the problem.Ables
Thanks, did you file the bug, by the way? (I did -- after playing with GLFW window creation mechanism for a while I discovered this -- sourceforge.net/tracker/…). Also, looking at their bug tracker suggests that mouse cursor coordinate tracking/etc may be seriously broken -- so beware!Krill
Ah, this is excellent. I will follow up on the tracker link right now. Good luck!Ables
You too. Btw. The developer says they already fixed mine one ;) That's good (I'll check tomorrow).Krill
I
10

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.

Insanitary answered 26/1, 2012 at 11:48 Comment(5)
Helpful feed back! Thank you! We are building for Mac in addition, but shooting for OSX 10.7 for that exact reason. I tried your hints and got the following: On my system, version 3.2.11318 results and works just fine. On the other computers, version 3.2.0 results and no geometry is drawn. Omitting the lines puts me at 4.2.11318, causing the usual graphics crash. Omitting theirs runs at 4.2.0 with full geometry, everything working fine. Haven't hit Google yet, but what's the significance of revision 11318? Is that responsible for this strange behavior?Ables
@AGuyInAPlace: I'm no OpenGL expert so I wouldn't know. Some general tip is to make sure each client's OpenGL drivers are up to date. I wouldn't know who to blame here, OpenGL or GLFW, but you can try and get in touch with the GLFW dev's on #glfw at freenode.Insanitary
We are all running the most recent version, but that sounds like an excellent next step. Thanks for the pointer!Ables
After running in plenty of circles, it turns out that this is half the battle; I also had to disable crossfire and GLFW seems to have no problems.Ables
You are guaranteed to get at least the version of OpenGL you asked for using glfwOpenWindowHint, even on systems where the driver itself doesn't check for this.Isaiasisak
W
0

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);
Wenz answered 12/4, 2013 at 0:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.