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

    DrawPoint2D() Clipped in OpenGL

    Scheduled Pinned Locked Moved SDK Help
    10 Posts 0 Posters 1.0k Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 03/06/2011 at 02:54, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:    Mac  ;  
      Language(s) :     C++  ;

      ---------
      I'm calling DrawPoint2D() from SceneHook::Draw().

      The position passed to DrawPoint2D() is calculated in camera space and converted to screen space.

      When the drawn point is 50 mm or less from a Perspective camera, it disappears. The threshold is exactly 50 mm, e.g. it is visbile at 50.01 mm.

      This only happens in OpenGL mode.
      Enhanced OpenGL makes no difference.
      No other viewport settings make any difference.
      It doesn't happen with a Parallel camera.

      I'm on an iMac 29.3 GHz i7 with an ATI Radeon HD 5750.

      What can the problem be?

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 03/06/2011 at 06:41, xxxxxxxx wrote:

        The vector returned by bd->CS() has a negative Z value. I've solved the problem by setting Z to 0 before passing the vector to DrawPoint2D().

        I'm not sure why it was happening specifically as described but at least it's fixed.

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 06/06/2011 at 06:33, xxxxxxxx wrote:

          Please check if changing the view clipping in the project settings makes a difference.

          cheers,
          Matthias

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 07/06/2011 at 03:09, xxxxxxxx wrote:

            Thanks Matthias, I wasn't aware of this setting and need to take it into account for my plugin.

            When passing the unmodified vector to DrawPoint2D(), the point is always clipped 50 mm from the camera. If its Z value is set to 0, the unwanted clipping never occurs. The View Clipping setting has no effect in either case.

            There appears to be an error in the SDK for BaseDocument::GetSettingsInstance(). I get the near clipping value like this:

              
            BaseContainer* bc = doc->GetSettingsInstance(DOCUMENTSETTINGS_DOCUMENT);   
            if(!bc) return TRUE;   
            Real nearClip = bc->GetReal(DOCUMENT_CLIPPING_PRESET_NEAR);   
            

            According to the SDK, DOCUMENTSETTINGS_DOCUMENT is private and I should be using DOCUMENTSETTINGS_GENERAL instead. If I use the latter, an invalid pointer is returned.

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 07/06/2011 at 03:59, xxxxxxxx wrote:

              Yes, thanks, the SDK has to be updated about document settings.

              cheers,
              Matthias

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 07/06/2011 at 08:13, xxxxxxxx wrote:

                How do you change these attributes?

                I've tried the obvious:

                  BaseContainer *bc = doc->GetSettingsInstance(DOCUMENTSETTINGS_DOCUMENT);  
                  if(!bc) return TRUE;  
                  
                  Real nearClip = bc->GetReal(DOCUMENT_CLIPPING_PRESET_NEAR);  
                  GePrint(RealToString(nearClip)); // Prints a value of 1  
                  
                  bc->SetData(DOCUMENT_CLIPPING_PRESET_NEAR, .01);//<--- Does not work  
                  bc->SetReal(DOCUMENT_CLIPPING_PRESET_NEAR, .01);//<--- Does not work  
                  bc->SetData(nearClip, .01);//<--- Does not work  
                  bc->SetReal(nearClip, .01);//<--- Does not work  
                  GePrint(RealToString(nearClip)); // still returns a value of 1  
                  
                  EventAdd();
                

                -ScottA

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 07/06/2011 at 09:10, xxxxxxxx wrote:

                  I have not tested yet, please give GetData/SetData a try.

                  cheers,
                  Matthias

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 07/06/2011 at 09:57, xxxxxxxx wrote:

                    ?
                    I am using SetData.

                    The closest thing to this that I've used is something like this:

                    BaseContainer *w = GetWorldContainerInstance();  
                    w->SetData(WPREF_MAX_UNDOS, 40); // Sets the number of undo's to 40
                    

                    And for the other kinds of BaseDocument containers(render settings, views settings, etc). This is the typical method to change  those attributes:

                    BaseDraw* bd = doc->GetActiveBaseDraw();    
                    bd->SetParameter(BASEDRAW_DATA_SDISPLAYACTIVE, 0, DESCFLAGS_SET_0); // Shading mode  
                    

                    These new R12 Document attributes seem to work a bit different from the other ones.
                    If you get the time. Can you please look into how to change these?
                    I'm in no big hurry for this information. So if you're too busy I can wait.
                    It's just something that would be nice to know how to do at some point.

                    Thanks,
                    -ScottA

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

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 07/06/2011 at 17:01, xxxxxxxx wrote:

                      You can use SetParameter like this:

                      doc->SetParameter(DOCUMENT_CLIPPING_PRESET_NEAR, GeData(0.01), DESCFLAGS_SET_0);
                      
                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 07/06/2011 at 17:50, xxxxxxxx wrote:

                        Thanks David.

                        Got it working now.🍺

                        -ScottA

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