VPBuffer is not updated [SOLVED]

On 22/12/2016 at 12:26, xxxxxxxx wrote:

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


I try to support my render engine in C4D's IRR.
The problem I'm trying to deal with is that the buffer is not updated as soon as I write to it.

The following code runs in VIDEOPOSTCALL_RENDER pass in close step.

VPBuffer color_buffer = render->GetBuffer(VPBUFFER_RGBA, 0);
bool test_break = vps->thread->TestBreak();
while ( !test_break ) { 
	//check if render engine has updated its image
	//if it has, get the image from the render engine and fill color_buffer using SetLine.
	//repeat until the thread breaks
	test_break = vps->thread->TestBreak();

Even though the color buffer is filled correctly, it is not updated in the viewport unless 
the thread breaks and the whole VIDEOPOSTCALL pipeline has to run again.
I break the thread by clicking the mouse in the viewport.

The reason why I use the above code in a while loop is because the render engine keeps updating its image, so I have to update C4D buffer as well.

Thank you for your time.

On 27/12/2016 at 07:12, xxxxxxxx wrote:

Hi Peterakos, thanks for  writing us.

With reference to your question, IRR has been designed to provide interactive rendering functionality by using a non-progressive rendering engine. Under this scenario it's not required to update the region frequently as the framebuffer gets updated but only when the rendering engine has finally completed its task or the user interacts with the scene.

Alternatively you can investigate the option to implement a GeDialog with a GeUserArea responsible to show the progressively refined framebuffer via its DrawBitmap() method.

Best, Riccardo.