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

    clipping GeUserArea on parent GeDialog [CLOSED]

    SDK Help
    0
    13
    961
    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.
    • H
      Helper
      last edited by

      On 17/02/2015 at 05:42, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R13.061 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hi to all,

      I'm using a GeUserArea to render some OpenGL content into. The parent of the GeUserArea is a GeDialog.
      When I scroll the GeUserArea in the GeDialog the user area overdraws other dialogs. 
      So I want to clip the UserArea on the borders of its parent GeDialog.

      Is this possible?
      If not, is it possible to just scroll the User Area?

      Thanks so far!

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 17/02/2015 at 06:22, xxxxxxxx wrote:

        Hi,

        I have to admit, I do not understand exactly, what you are trying to do or what is happening. Sorry 😢

        Somehow your description reminds me a bit of another thread (see here). Maybe you can look into it and see, if your problem is similar.

        If not, please try to describe your situation in a bit more detail. At best with some code snippets.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 18/02/2015 at 02:50, xxxxxxxx wrote:

          Hi Andreas,

          thanks for your help.
          The issue you found is exacly the same issue posted by my colleague.
          See the following 2 pics:

          Nr 1.:

          Nr.2:

          Nr1 shows how it should be. No overdraw. Nr 2 shows the error. What I want to do is to clip the user area at the parent dialog's borders to remove the graphical error.

          If there is any other way to draw openGL content and clip it (instead of user area) I'm all ears.
          Thanks in advance.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 18/02/2015 at 02:59, xxxxxxxx wrote:

            uups, uploading pics not possible...

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 18/02/2015 at 04:51, xxxxxxxx wrote:

              I didn't see the images so I can't judge, but try these 2 lines in the start of GeUserArea::DrawMsg() virtual function:

              	OffScreenOn();
              	SetClippingRegion(x1,y1,x2,y2);
              
              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                On 18/02/2015 at 05:43, xxxxxxxx wrote:

                Thanks, Mohamed, but didn't work.
                I had a closer look at the code and think the issue is not related  to the user area.
                We create a child hwnd from a GeDialog via WinApi's CreateWindowEx() and this window is not clipped out of the dialogs client area  if it is repositioned via WinApi's MoveWindow() function. It just draws over other C4D gui- elements.
                Any ideas?

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  On 18/02/2015 at 10:44, xxxxxxxx wrote:

                  ok, i know more about the issue right now.
                  - We use a HWND to render OpenGL into.
                  - this HWND is created via CreateWindowEx()
                  - it's parent HWND (lets call it pHWND) is derived via iCustomGui::GetWindowHandle()
                  --the problem:  pHWND is not a HWND from some window in the attribute manager, it is the C4D- Mainwindow.

                  So to solve that:

                  - how can I obtain a hwnd from the attribute manager to use as pHWND?

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    On 18/02/2015 at 10:46, xxxxxxxx wrote:

                    I'm sorry, but as far as I know, you can't. 😢

                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

                      On 18/02/2015 at 11:41, xxxxxxxx wrote:

                      I think the best approach is render this OpenGL with Cinema4D classes "C4DGL" , it is difficult to do, but it is doable

                      1 Reply Last reply Reply Quote 0
                      • H
                        Helper
                        last edited by

                        On 19/02/2015 at 02:19, xxxxxxxx wrote:

                        @Mohamed:
                        Could you point me somewhere?
                        I couldn't find anything by Google/Maxon documentation

                        @Andreas:
                        Perhaps C4D dialog system can also do the trick. Basically i need the hwnd only for 2 things:

                        1.) parent-child relationship to obtain clipping of child window on parent windows borders. This is obviously done in C4D with other dialogs.

                        2.) Obtaining a HDC (HDC h= GetDC( hWnd );) for OpenGL rendering.

                        I don't know where to look in the documentation to get an idea, probably you know better...

                        1 Reply Last reply Reply Quote 0
                        • H
                          Helper
                          last edited by

                          On 19/02/2015 at 02:48, xxxxxxxx wrote:

                          it depends on what you are drawing with OpenGL, you need to specify more.
                          in general the SDK got "as I remember" 4 examples,  gl_test_object, gl_material, vpstereo, and another example which I don't remember its name, 1 of them is using vertex buffer object, others are using frame buffer object.

                          the documentation is limited "no docs!!" , so just reading the header with OpenGL experience and deep C++ experience should let you get your feet wet.

                          I played with gl_test_object example, and "hacked" the OpenGL VBO "from CUDA context" as Cinema4D doesn't give the VBO handle!!, so it was some fun time doing it , here is the result:

                          1 Reply Last reply Reply Quote 0
                          • H
                            Helper
                            last edited by

                            On 19/02/2015 at 03:57, xxxxxxxx wrote:

                            @Mohamed: cool demo!

                            1 Reply Last reply Reply Quote 0
                            • H
                              Helper
                              last edited by

                              On 23/02/2015 at 02:32, xxxxxxxx wrote:

                              ok, after fumbling around forever with windows and clipping, i worked around the issue. Isn't perfect, but works ok. What i did:
                              I create a hwnd of a smaller size so i don't get a vertical scrollbar (which messes up the win-coords you get over GeUserArea::DrawMsg().
                              I don't move the window, so clipping is not necessary. Instead i listen to GeUserArea::InputEvent() and catch the mouse wheel (seems to be the only input you can get in that function). I use this data to transform the view in Open GL only, so the window i create doesn't move.

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