Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    OpenGL in Cinema 4D

    Cinema 4D SDK
    python r25
    3
    6
    1.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gheyretG
      gheyret
      last edited by

      hello everyone!
      is that posible to attach an OpenGL window to Cinema 4D GUI using python?
      if posible , how can i do that?

      www.boghma.com

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @gheyret
        last edited by

        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 using c4d.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

        MAXON SDK Specialist
        developers.maxon.net

        gheyretG 1 Reply Last reply Reply Quote 1
        • gheyretG
          gheyret @ferdinand
          last edited by

          @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?

          www.boghma.com

          1 Reply Last reply Reply Quote 0
          • ferdinandF
            ferdinand
            last edited by ferdinand

            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. In GeDialog 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

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 0
            • fwilleke80F
              fwilleke80
              last edited by

              @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 😉

              www.frankwilleke.de
              Only asking personal code questions here.

              gheyretG 1 Reply Last reply Reply Quote 1
              • gheyretG
                gheyret @fwilleke80
                last edited by

                @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🥂

                www.boghma.com

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post