Different initGLImage for each object

On 22/09/2015 at 06:28, xxxxxxxx wrote:

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


I have created a material plugin and whenever i assign that material to an object the initGLImage runs to calcualte the bitmap that will be used in the viewport.
I want different image based on each object.
Can i do that somehow ?

As i see, even though i assign the same material in multiple objects, initGLImage runs only once.

Thank you.

On 22/09/2015 at 11:45, xxxxxxxx wrote:

I think it is doable.

in simplematerial example, check for MATPREVIEW_MODIFY_CACHE_SCENE
depending on the scene, you can set a member with the required data.
make sure to copy that member "CopyTo function"

using that member, you can change the initGLImage behavior.

On 23/09/2015 at 02:11, xxxxxxxx wrote:


don't confuse the material preview image of the material editor with the OpenGL preview image. The OpenGL preview image is used to create a preview of a complex material in the interactive viewport. This bitmap is stored with the material and is only created for the material, not for each material/object combination.

Best wishes,