Some OpenGL functions not available in Windows?

My app works great in Mac but isn’t working in Windows. At first, it wouldn’t compile until I added JUCE_OPENGL3=1 as a preprocessor macro but now it just crashes and what seems to be happening is that in OpenGlExtensionsFunctions, there are a couple functions not being made available which should be loaded dynamically (I guess?). These appear to be the JUCE_GL_VERTEXBUFFER_FUNCTIONS.

Here’s a shot from my code:

And I trace it back to where these functions are loaded.

It looks like since I added JUCE_OPENGL3=1, these functions should be available but they are not. I would super grateful for any help with this.

Are you using the OpenGLExtensionFunctions member provided by the active OpenGLContext or are you using your own declaration of the struct? In the latter case, you must call the initialise() function for the struct which performs the dynamic loading, as seen here:

1 Like

I was doing it as my own declaration. If I start with initialize(), I now get an exception thrown in the function initializeOnThread().

I tried it both ways, same error in the same place.

I would go with using the extension function struct included with the OpenGLContext, since it does the initialisation for you, in essence:

void renderOpenGL()
    OpenGLContext &gl = *OpenGLContext::getCurrentContext();

Okay let me try that

Also bear in mind that the large majority of the OpenGL functions and macros are not wrangled within OpenGLExtensionFunctions. In fairness, there are a shit load of em but it’s totally feasible to do…

I made a feature request for that: FR: Wrangle a comprehensive set of OpenGL functions & macros


I replaced it my “gl” with that snippet everywhere but it still throws an exception on the initializeOnThread function.

Does that mean anything to you? In xCode, I can usually see more detail about what’s going on with the debugger than this so I apologize if I just am not seeing certain details.

Did you find a way to resolve this issue? I am currently running into the same thing with the windows build of my new plugin which uses OpenGL 3 and glBindVertexArray.

I’m not 100% sure, since I never tested it myself. On Windows all OpenGL functions are provided via the wgl context functions. I think the one used in JUCE loads one of the oldest GL versions (2.1?) possible. This call is used:

Now isn’t it necessary to explicitly request a higher GL version (e.g. 3.1) to actually load the newer GL functions?

It seems for this purpose the WGL_ARB_create_context extension is provided. Similar to the pixel format extension, you have to query/load the extension first. Read more about it here:

And here an example:

Especially this part:

int attribs[] =

if(wglewIsSupported("WGL_ARB_create_context") == 1)
	m_hrc = wglCreateContextAttribsARB(pDC->m_hDC,0, attribs);