GNOME Bugzilla – Bug 669788
Actor for custom 3D code
Last modified: 2021-06-10 11:33:22 UTC
Hello, I've recently had the need to overlay some 3D objects over a 2D image. I wrote a blog post about it here: http://radialmind.blogspot.com/2012/02/cogl-or-opengl-for-3d-clutter-scenes.html It's basically a display for video pilots, where the background comes from video, but which has 3D objects painted over it, referenced to their location in the actual world (augmented reality). Over all of this another display is painted using some standard text and bitmap actors. Raw OpenGL ended up as a disaster when used together with Clutter, so I turned to Cogl instead and that worked out in the end. I figured that some other people may have the same need in the future. For example some 3D viewers of some kind may really benefit from having a couple of 2D elements at the side to manipulate some 3D object in the middle. So here's a suggestion for a new feature: - A new clutter actor that allows people to define a custom rendering function that gets called as part of the main render loop and where the actor saves and restores the openGL context properly. Some things that developers may do are not necessarily restorable and that's a limitation for this kind of actor. E.g.: projection matrices cannot be manipulated, because the 3D custom code won't display this properly. The example in the blog post above shows some basic code that does work and for such simple things, this method works quite well.
the only way to allow using GL from within Clutter and Cogl is to create a second GL context, bind it to a FBO, and allow a push/pop operation. there is no way to actually guarantee that the Cogl state is going to be saved and restored in a compatible way, otherwise. there has been some proof-of-concept work in Cogl to allow creating a GLES context, in order to implement WebGL support in the Clutter backend for WebKit: http://blog.tomeuvizoso.net/2011/12/webgl-support-in-webkit-clutter.html this work would lead to creating a simple GL actor, with a custom paint function that allows dropping into GL without breaking the Cogl state.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version of clutter, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a ticket at https://gitlab.gnome.org/GNOME/clutter/-/issues/ Thank you for your understanding and your help.