ofGLProgrammableRenderer on Windows

I’m not sure if this is a known bug on windows (I see that this happens for macs with 10.6.8), but using ofGLProgrammableRenderer, via ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE), throws:

[ error ] ofAppGLFWWindow: couldn't create GLFW window
[ error ] ofAppGLFWWindow: couldn't create window

and crashes.

I’m on Windows 7 (64) under Code::Blocks 12.11. I ran glInfoExample:

-------------------------------------------------
opengl info
-------------------------------------------------
version=3.1.0 - Build 8.15.10.2455
vendor=Intel
renderer=Intel(R) HD Graphics Family

So I should be go to go in that openGL 3.0 is supported on my GPU, right? Anyone have a clue what’s going on?

This looks like a bug. Openframeworks does not query the opengl version you have. Go to ofApp.cpp See the line where it says

static_cast<ofAppGLFWWindow*>(window.get())->setOpenGLVersion(3,2);

change that to 3,1. see if that works.

void ofSetupOpenGL(ofPtr<ofAppBaseWindow> windowPtr, int w, int h, int screenMode){
    if(!ofGetCurrentRenderer()) {
	#ifdef USE_PROGRAMMABLE_GL
	    ofPtr<ofBaseRenderer> renderer(new ofGLProgrammableRenderer(false));
	#else
	    ofPtr<ofBaseRenderer> renderer(new ofGLRenderer(false));
	#endif
	    ofSetCurrentRenderer(renderer,false);
    }

	window = windowPtr;

	if(ofIsGLProgrammableRenderer()){
        #if defined(TARGET_RASPBERRY_PI)
		static_cast<ofAppEGLWindow*>(window.get())->setGLESVersion(2);
		#elif defined(TARGET_LINUX_ARM)
		static_cast<ofAppGLFWWindow*>(window.get())->setOpenGLVersion(2,0);
		#elif !defined(TARGET_OPENGLES)
		static_cast<ofAppGLFWWindow*>(window.get())->setOpenGLVersion(3,2);
		#endif
	}else{
	    #if defined(TARGET_LINUX_ARM) && !defined(TARGET_RASPBERRY_PI)
		static_cast<ofAppGLFWWindow*>(window.get())->setOpenGLVersion(1,0);
		#endif
	}

	window->setupOpenGL(w, h, screenMode);
}

1 Like

@Ahbee thanks for the suggestion, but no dice on that change.

I tried 3.0 as well - no luck. 2.0 works, but then the blur shader from the tutorial page doesn’t appear to be working correctly (though that might be a problem with the code)

Edit. Here’s the report for 3.1 and 3.2. Versions less than 3.1 come out with all OKs.

GL_VERSION_3_1:                                                OK 
---------------
  glDrawArraysInstanced:                                       OK
  glDrawElementsInstanced:                                     OK
  glPrimitiveRestartIndex:                                     OK
  glTexBuffer:                                                 OK

GL_VERSION_3_2:                                                MISSING 
---------------
  glFramebufferTexture:                                        OK
  glGetBufferParameteri64v:                                    MISSING
  glGetInteger64i_v:                                           MISSING

inside ofAppGLFWWindow::setupOpenGL(int w, int h, int screenMode) comment out all of the glfwWindow hints. see if that works?. If so, then uncommmet them one by one to see where the problem is.

1 Like

GL Extension Viewer should be able to give you a pretty good rundown of the GL version support your card/driver/OS have on offer.

1 Like

@pizthewiz Thanks for that link! There was an update for my intel card that slightly upped my opengl support, though still not enough 3.2 support for ofGLProgrammableRenderer to work.

But! It made me realize that I’ve been running everything on my integrated, intel card rather than my dedicated nvidia card (which supports up to opengl 4.4). I never had the need to specify which card to use when running an exe, so it didn’t occur to me. Using the dedicated card solved my problem - ofGLProgrammableRenderer works and the blur shader from the tutorials runs perfectly.

@Ahbee Thanks for that tip. When I use opengl 3.1, the line that is causing the crash is glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE). From reading up on [GLFW][1]:

The following additional hints are hard constraints if requesting an OpenGL context:

GLFW_OPENGL_FORWARD_COMPAT
GLFW_OPENGL_PROFILE

and

If an OpenGL context is requested, the GLFW_OPENGL_PROFILE hint specifies which OpenGL profile to create the context for. Possible values are one of GLFW_OPENGL_CORE_PROFILE or GLFW_OPENGL_COMPAT_PROFILE, or GLFW_OPENGL_ANY_PROFILE to not request a specific profile. If requesting an OpenGL version below 3.2, GLFW_OPENGL_ANY_PROFILE must be used.

With GLFW_OPENGL_PROFILE being a hard constraint, if that hint fails, the window won’t be created. And since I don’t have support for GLFW_OPENGL_CORE_PROFILE, I needed to use GLFW_OPENGL_ANY_PROFILE. When I do that, the window is successfully created…even though the blur shader is still broken.

So something is still unsupported with opengl 3.1, but my desire to dive any deeper has waned given that I can just switch over to my dedicated card whenever I want to do anything with shaders. Thanks to you both for the help!
[1]: http://www.glfw.org/docs/latest/window.html

not that it matters now but in 3.1, the GLSL version in 1.4 so in your shaders you have to put

 	#version 140

Ah, hmm. I just gave that a shot with 3.1 and GLFW_OPENGL_ANY_PROFILE, but it still didn’t end working on the intel card. Oh well. At least this was a learning experience.

we use 3.2 for the programmable renderer so that’s probably why it isn’t working

1 Like