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

    Force shader OGL update

    SDK Help
    0
    4
    1.2k
    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 07/05/2018 at 15:31, xxxxxxxx wrote:

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

      ---------
      Is there a way to force the shaders to update so that they get a call to InitGLImage? Or a way to send a message to shaders so that I can have them set their own dirty flags, which I would hope in turn would trigger a call to InitGLImages.

      The only way I can see to get shaders to update is by advancing one frame in the timeline, which is a very hacky solution.

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

        On 08/05/2018 at 05:15, xxxxxxxx wrote:

        Hi Kent, thanks for writing us.

        With reference to your request, you can easily force InitGLImage being called by marking a shader as dirty using BaseShader::SetDirty(DIRTYFLAGS_DATA). This will automatically force the shader preview thread to get re-executed and, consequently the InitGLImage() to be called.

        Hope this helps, Riccardo.

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

          On 08/05/2018 at 18:18, xxxxxxxx wrote:

          Hi Riccardo,

          Thanks for that.

          Do you know of a way to send a message to a shader? IE something like CoreMessage. Then I can pick up the message in the shader itself and set its dirty flag.

          Otherwise I will either have to scan the document looking for the shader on all materials, or shaders will need to register themselves with a scenehook or object   so that I can call them when required to make them dirty.

          Being able to send a message would be the ideal way.

          Thanks,
          Kent

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

            On 10/05/2018 at 16:31, xxxxxxxx wrote:

            I have gone with the idea of registering and deregistering shaders with an object. The object can then directly tell shaders that they are dirty and need updating in the viewport. Note that this a very specific solution that fits my needs and is not a general solution to the problem.

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