MaartenBaert / ssr

SimpleScreenRecorder, a screen recorder for Linux
http://www.maartenbaert.be/simplescreenrecorder/
GNU General Public License v3.0
2.57k stars 290 forks source link

OpenGL recorder uses deprecated GL calls. #728

Open stolk opened 5 years ago

stolk commented 5 years ago

The GL calls that ssr-glinject uses seem to be incompatible with a Core-Profile modern OpenGL driver.

It produces the error:

ERR [API][Error]{High}: GL_INVALID_OPERATION error generated. Function glPushAttrib is deprecated and not available in preview contexts.

Function glPushAttrib is deprecated

[SSR-GLInject] Warning: glXSwapBuffers called without existing frame grabber, creating one assuming window == drawable.
[SSR-GLInject] [GLXFrameGrabber 1] Created GLX frame grabber.
[SSR-GLInject] [/dev/shm/ssr-channel-bram/video-506345456541-26566-glx0001-Train] Created video stream.
[SSR-GLInject] OpenGL version = 3.3 (3.3.0 NVIDIA 430.40).
[SSR-GLInject] [/dev/shm/ssr-channel-bram/video-506345456541-26566-glx0001-Train] frame size = 1920x1080.

To reproduce, you need an OpenGL application that enables the ARB_DEBUG_OUTPUT extension, using the glDebugMessageCallback() and glDebugMessageControl() calls, and doing a glEnable(GL_DEBUG_OUTPUT) call.

Version: 0.3.8-3

Platform: Ubuntu LTS.

MaartenBaert commented 5 years ago

That's going to be hard to change. Core OpenGL assumes that applications are aware of the current state of the graphics pipeline so there is no need for these calls, but for GLInject I need to be able to save and restore the current state. The only alternative I see is to hook all calls to OpenGL functions that can change the state, so I can restore the last setting myself, but that sounds really painful and may have a significant performance impact. Or I could just reset the state to a sensible default state and hope that the application won't care, but that will probably break things for some applications.

stolk commented 5 years ago

If it is not needed, maybe skip it when you detect core profile? Or if that is not possible, add an ENV VAR, SSRCOREPROFILE, and when set by user, skip the gl calls?

On second thought, the latter option is safer, as it won’t alter default behavior.

stolk commented 5 years ago

Lastly, in my experience, what trips up Core Profile most, is setting glLinewidth, which is not allowed. If you do that in Ssr, maybe just skip that single setting on core profile runs?