Public interface of OpenGLDrv

Hi all,

I’m coding a plugin to do quad buffer stereo. For this I’m trying to use the with a custom Present callback function. This plugin needs access to some opengl functions and to the opengl device context. I can add OpenGLDrv to my dependency modules list but as soon as I try to include any of the public include files I get lots of compile errors. Does anyone have any pointers?

I’m using version 4.6.1 from github.

Best regards,
Pjotr

Just an update from my side. I kinda got it working by copy/pasting some stuff from the private headers. Not a really nice solution as it means I will have to keep everything I copied up to date. But the good news is that I now have quad buffer stereo working under windows.

I have seen more people asking about how to get the opengl functions working on the forums. So here is how I did for future reference. The trick is to redefine the opengl functions again (see the DECLARE_GL_ENTRYPOINTS and ENUM_GL_ENTRYPOINTS_ALL declarations in OpenGLWindows.h). I also had a weird problem that when building the ‘development editor’ configuration I got unresolved symbols for the functions but when building the ‘development (game)’ configuration it could resolve them. Because of this I had to make use of the defines the build system sets to distinguish between the two configurations and for the editor I had to extract the extract points all over again.

For the opengl device context I had to include “OpenGLResources.h” and copy/paste FPlatformOpenGLContext struct definition from the private headers.

Hi,

Could you give some more details on what exactly you need to include please?

Looking back at the code:

  • in my build.cs i have:
    – added “OpenGL” to AddThirdPartyPrivateStaticDependencies
    – added “OpenGLDrv” to PrivateDependencyModuleNames
    Basically I copied all the declarations out of OpenGLWindows.h
    I also had to make a function to initialize the opengl functions, the functions includes the same code that is in the if (bOpenGLSupported) {} block inside OpenGLWindows.cpp block. This function I call manually before using any of the opengl defines.
    I know, not really a nice solution but this is a workaround till Epic makes more of their OpenGL interface public in their OpenGLDrv module.

Thanks!

We’re still not clear on how we need to redefine the opengl functions again, Could you show your OpenGLWindows.h file changes.

If you have installed UE4 and are running the launcher from there, you will get the “can’t find files error” for the open gl headers when including OpenGLWindows.h

In the Source/ThirdParty/OpenGL/ directory the folders containing the headers are not included. If you download the source from GitHub you will find the Gl/ subdirectory folder with the proper headers to build against.

You can copy them to the their proper place in your install source folder, or copy them into a ThirdParty/ folder in your plugin and add the path to them in your build file.

This should save you the trouble of having to redo the initialization work.