Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    DrawTexture related crashes

    Cinema 4D SDK
    2
    4
    675
    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.
    • C4DSC
      C4DS
      last edited by C4DS

      Has something changed related to BaseDraw::DrawTexture in R23?

      I am trying to port my plugins (working fine in R16 .. R21). But each time I perform a DrawTexture I get a crash in c4dplugin.
      The crash does not happen at the time of performing the call but somewhere afterwards.

      Other BaseDraw drawing methods like DrawPolygon, DrawLine, DrawPointArray, etc ... are working fine.

      Edit:
      Forgot to mention this drawing happens in context of SceneHook::Draw. During the draw-pass.

      1 Reply Last reply Reply Quote 0
      • C4DSC
        C4DS
        last edited by C4DS

        Did some further searches and seems I can resolve the issue by using:

        bd->DrawTexture(bitmap, positions, nullptr, nullptr, uvcoords, 4, DRAW_ALPHA::NORMAL, DRAW_TEXTUREFLAGS::INTERPOLATION_NEAREST | DRAW_TEXTUREFLAGS::TEMPORARY);
        

        whereas I had used DRAW_TEXTUREFLAGS::NONE in the past.

        1 Reply Last reply Reply Quote 0
        • M
          m_adam
          last edited by

          Hi As the documentation state since S22, DrawTexture doesn't copy in every situation the BaseBitmap (which is way more efficient). However, that implies either you ensure the basebitmap is allocated and alive as long as it is displayed or you pass the flag DRAW_TEXTUREFLAGS::TEMPORARY so a copy is done internally and you are safe 🙂

          Hope this help.
          Cheers,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          C4DSC 1 Reply Last reply Reply Quote 0
          • C4DSC
            C4DS @m_adam
            last edited by

            @m_adam Thanks for that extra info.
            I had done a search in the documentation regarding DrawTexture but didn't see it listed in the API changes. Hence, I didn't expect its behaviour to have changed so drastically.
            I haven't worked with S22 nor R23 before, so I didn't look in detail about the DrawTexture documentation, since it wasn't listed as changed.

            May I encourage this to be added in API Changes ... as it is quite a big deal encountering this issue when all worked fine in R16 upto R21.

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