Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search

Force shader OGL update

Author
Message
  Topic Search Topic Search
kbar View Drop Down
Member
Member
Avatar

Joined: 2009 Feb 12
Location: New Zealand
Online Status: Offline
Posts: 77
Direct Link To This Post Topic: Force shader OGL update
    Posted: 2018 May 07 at 3:31pm

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.
Back to Top
knickknack View Drop Down
Forum Moderator
Forum Moderator


Joined: 2016 Jul 01
Location: Italy
Online Status: Offline
Posts: 268
Direct Link To This Post Posted: 2018 May 08 at 5:15am
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.
MAXON Computer GmbH
SDK Support Team
Back to Top
kbar View Drop Down
Member
Member
Avatar

Joined: 2009 Feb 12
Location: New Zealand
Online Status: Offline
Posts: 77
Direct Link To This Post Posted: 2018 May 08 at 6:18pm
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
Back to Top
kbar View Drop Down
Member
Member
Avatar

Joined: 2009 Feb 12
Location: New Zealand
Online Status: Offline
Posts: 77
Direct Link To This Post Posted: 2018 May 10 at 4:31pm
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.
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.