OpenGL in Cinema 4D
-
hello everyone!
is that posible to attach an OpenGL window to Cinema 4D GUI using python?
if posible , how can i do that? -
Hello @gheyret,
thank you for reaching out to us.
You have some control over
BaseView
in the Python API, a Cinema 4D viewport. You can also create a new viewport usingc4d.CallCommand
. Retrieving the BaseDraw for a given viewport, you can also perform drawing operations in such viewport which are similar to the fundamental drawing operations available in a generic 3D graphics real time renderer, e.g., an OpenGL context.Neither in the public Python nor C++ API are any generic 'OpenGL window' classes to find. This is done intentionally to keep the UI of Cinema 4D clean, as relevant information should be drawn into a viewport. If you require a 3D graphics real time renderer where you have full control, you must use something as QtOpenGl for Python. Such windows will not be dockable within Cinema 4D and you will also have to ensure platform (Win/Mac) compatibility on your own.
Cheers,
Ferdinand -
@ferdinand
Hi!
Actually, i developed a simple model viewer using PyOpenGL and GLFW(for the window).
And i don't know if i can use CINEMA 4D VIEWPORT(replace the GLFW) to show my own OpenGL things.
So , clearly i need a dockable opengl window. is that possible? -
Hello @gheyret,
no, that is not possible, as there is no viewport control which you could add to a
GeDialog
and you cannot dock external window handles into Cinema 4D. The only thing you could do, is cleverly place a borderless window containing some sort of external OpenGL viewport over the Cinema 4D GUI and hide its process from the taskbar. InGeDialog
you can figure out the screen coordinates of a dialog with the coordinate methods. But that would all be very much a duct tape solution.And I cannot stress this enough: These limitations are intended to ensure certain standards within the Cinema 4D GUI. We cannot provide support for integrating third party GUIs into Cinema 4D.
Cheers,
Ferdinand -
@gheyret
I don't know much about OpenGL. If it's possible to export the frame buffer into a bitmap-like structure, you might be able to display it in a GeUserArea, which again would be in a GeDialog, which then can be docked into the C4D layout. I guess, that would require quite a rewrite of your code, though -
@fwilleke80
Yes, it's a solution. But it's can not to orbiting the scene or transforming the model.
I think i need to make a desktop application, and make sure the window always on top.
However, this will lead to more work for me.
And thanks to your reply!
cheers