Hello everybody!
Basically I have QT5 scene graph and Ogre 1.8, both running on OSX.
The idea is to get Ogre initialized so that it uses the window and GL context created by QT,
and Ogre would just render it's output to a texture.
This texture would be then composited with the QT5 scene graph system.
What I have gathered, the window creation is always mandatory to get some internal structures
initialized, even if I just want to render to texture in existing context. (qmlogre example)
I also see that on OSX, the OpenGL backend doesn't even support "externalGLControl" or "externalGLContext" settings,
which makes me wonder if this is even possible to do on OSX without hacking the Ogre itself?
I have been tinkering for few days to get them working together, but as I have not found a real
solution, I thought I should ask here. I'd would be very nice if you could share your thoughts on the topic.
BR,
Markus
OpenGL context sharing on OSX
- masterfalcon
- OGRE Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
- Contact:
Re: OpenGL context sharing on OSX
Check out the externalWindowHandle parameter, sounds like that is what you're looking for.
-
- Gnoblar
- Posts: 5
- Joined: Sat Nov 24, 2012 12:50 am
Re: OpenGL context sharing on OSX
It seems that a new GL context is initialized no matter what. ExternalWindowHandle seems to just set the NSView for the newly created context, but doesn't prevent the creation.masterfalcon wrote:Check out the externalWindowHandle parameter, sounds like that is what you're looking for.
In OgreOSXCocoaWindow.mm there's:
Code: Select all
glContext = [[NSOpenGLContext alloc] initWithFormat: openglFormat shareContext:shareContext];
Code: Select all
[glContext setView:mView];
Or I'm I overlooking something here?
BR,
Markus
- masterfalcon
- OGRE Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
- Contact:
Re: OpenGL context sharing on OSX
Yeah, looks like you're right. In fact it seems that only Windows actually implements the externalGLControl and Context.
-
- Gnoblar
- Posts: 5
- Joined: Sat Nov 24, 2012 12:50 am
Re: OpenGL context sharing on OSX
Hmm. I hacked ogre's CreateRenderWindow a bit, so it now accepts ExternalGLContext -parameter. This is basically NSOpenGLContext*, which (if supplied) skips this line, and uses the given context instead.
I have confirmed with XCode OpenGL profiler, that the QT's context is now being used. The problem is that result is still the same. QT window becomes just a white window. (which "works" but I can't see anything)
I'm guessing there's some other initialization going on, which I need to suppress. (pixel format changing maybe)
I'm also starting wonder if there's some completely other mechanism to get ogre in RTT mode. (no window, just rendering to a texture)
Could you point me into direction please?
BR,
Markus
Code: Select all
mGLContext = [[NSOpenGLContext alloc] initWithFormat:mGLPixelFormat shareContext:shareContext];
I'm guessing there's some other initialization going on, which I need to suppress. (pixel format changing maybe)
I'm also starting wonder if there's some completely other mechanism to get ogre in RTT mode. (no window, just rendering to a texture)
Could you point me into direction please?
BR,
Markus
- masterfalcon
- OGRE Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
- Contact:
Re: OpenGL context sharing on OSX
Could be that the view is not being updated(or rendered to). Check for that and also in the log for any errors.
-
- Gnoblar
- Posts: 5
- Joined: Sat Nov 24, 2012 12:50 am
Re: OpenGL context sharing on OSX
Log doesn't show anything odd. I guess I'm going to have a long read through osx cgl documentation.
-
- Gnoblar
- Posts: 18
- Joined: Tue Oct 03, 2017 11:26 pm
Re: OpenGL context sharing on OSX
Hey, was anyone able to get this working?
Thanks
Thanks