update render buffer directly from GPU

On 28/10/2014 at 12:26, xxxxxxxx wrote:

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

how can I get the GPU buffer pointer, so I can update it directly from my CUDA renderer, instead of copying GPU->CPU->GPU

what I see from VPInvertImage example, it updates the rgba buffer line by line:

rgba->GetLine(x1, y, cnt, buffer, 32, true);
rgba->SetLine(x1, y, cnt, buffer, 32, true);

if I can't access the GPU buffer, is there a way to create another OpenGL frame buffer and update to it? "any SDK example to look at would be appreciated"

On 29/10/2014 at 03:23, xxxxxxxx wrote:


Why do you want to write to a GPU buffer?

A Renderer (like any other Videopost) writes it's results into a framebuffer that is stored in the ordinary RAM. Depending on what are you doing Cinema will take this framebuffer and display it in the Viewport, the Picture Viewer or save it to a file. If you are using RenderDocument() you can do whatever you like with the render result in the used BaseBitmap.

The InvertImage example Videopost does not edit any GPU buffer. It's Execute() function is called for rendering the final frame (on CPU). The extended OpenGL preview is manged by GlDraw(). This function adds a custom shader to the BaseDraw. But these functions are not documented.

You may be able to create another OGL framebuffer but that has nothing to do anymore with the Cinema SDK.

best wishes,

On 30/10/2014 at 07:42, xxxxxxxx wrote:

Hi Sebastian,

thanks for clarification, my Renderer got 2 engines, one which uses CPU "so writing and displaying results in a similar way to InvertImage example" , and another engine which uses GPU (CUDA) , displaying progressive data using CUDA will make lots of copying between CPU/GPU memory which is not needed in that case "although the final result must be saved to CPU as you know"