Page 1 of 1

OpenGLDriver: Calling makeCurrent() on every beginScene() ?

Posted: Thu Jan 21, 2016 6:51 pm
by devsh
Why are you doing this to me?

No, but really, what is the reason for calling changeRenderContext every frame?

*Its like the most painfully slow OpenGL call you can make (takes roughly 0.25ms)

Re: OpenGLDriver: Calling makeCurrent() on every beginScene(

Posted: Thu Jan 21, 2016 7:01 pm
by Nadro
Hi,

Thanks for a report this issue, it'll be fixed in the upcoming commit.

Cheers,

Re: OpenGLDriver: Calling makeCurrent() on every beginScene(

Posted: Thu Jan 21, 2016 7:25 pm
by hendu
I wonder if that's needed for the Qt and WxWidgets embedders?

Re: OpenGLDriver: Calling makeCurrent() on every beginScene(

Posted: Thu Jan 21, 2016 8:28 pm
by elvman
Actually this is needed for OSX, because render context can be changed by OSX GUI. I fixed this bug for cocos2d-x by also making the context current before every frame: https://github.com/cocos2d/cocos2d-x/pull/14598

Re: OpenGLDriver: Calling makeCurrent() on every beginScene(

Posted: Fri Jan 22, 2016 12:37 am
by Mel
Perhaps you could make that "changeRenderContext" OSX specific then?

Re: OpenGLDriver: Calling makeCurrent() on every beginScene(

Posted: Fri Jan 22, 2016 11:55 am
by hendu
Qt and Wx also run on Linux, Windows, etc. So if they need it, you can't filter by platform.

Re: OpenGLDriver: Calling makeCurrent() on every beginScene(

Posted: Fri Jan 22, 2016 6:49 pm
by Nadro
I'll check how this situation looks at OSX 10.9. If it will be required for Qt, wx etc. we can call glMakeCurrent only when SIrrlichtCreationParams::windowId isn't equal NULL, however IIRC this issue is just my mistake (missing simple 'if') :P