Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot deploy GLFW 3.2

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.

like image 389
AGuyInAPlace Avatar asked Jan 26 '12 10:01

AGuyInAPlace


People also ask

What version of OpenGL does GLFW use?

Most modern drivers do this. Explicit creation of OpenGL contexts of version 3.0 and above on Windows and X11, including profiles and flags, is supported by GLFW 2.7 and later.

Is GLFW in c++ or C?

GLFW is written in C and supports Windows, macOS, X11 and Wayland.

What is GLFW vs OpenGL?

GLFW or freeglut will allow us to create a window, and receive mouse and keyboard input in a cross-platform way. OpenGL does not handle window creation or input, so we have to use these library for handling window, keyboard, mouse, joysticks, input and other purpose.


1 Answers

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.

like image 99
orlp Avatar answered Sep 30 '22 04:09

orlp