On 20/08/2015 at 13:06, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 15+
Platform: Windows ;
Language(s) : C++ ;
---------
this question may be related to an old thread, https://plugincafe.maxon.net/topic/8414/10991_q-about-renderdocument-custom-renderer-solved
where Joey said:
"the bitmap passed as "image->pDest" to RenderDocument() becomes the internal render bitmap of type MultipassBitmap. When you call "vps->render->GetBuffer(VPBUFFER_RGBA, NOTOK)", you get the renderer's MultipassBitmap pointer. As stated in the documentation, a VPBuffer is represents the same class internally as a MultipassBitmap, so a VPBuffer can be cast to the latter, and vice versa. Therefore, you should be able to fill the bitmap to view the results in the material preview window."
so what I try to do is adding a new layer to the VPBuffer* when rendering, it may be illegal the way I do, so may be some advice..
a code snippet:
//header
VPBuffer* m_rgba;
MultipassBitmap* m_test_;
//cpp
m_rgba = vps->render->GetBuffer(VPBUFFER_RGBA, NOTOK);
MultipassBitmap *rgba = (MultipassBitmap* )m_rgba;
m_test_ = rgba->AddLayer(rgba, COLORMODE_ARGBf);
//writing
for (int yy = y; yy < y + h; ++yy)
{
m_rgba->SetLine(x, (y2 - y1) - yy, w, &pData[(yy - y) * w * 4], 32, true);
VPBuffer* m_test = (VPBuffer* )m_test_;
m_test->SetLine(x, (y2 - y1) - yy, w, &pData[(yy - y) * w * 4], 32, true);
}
this crashes, didn't check where it crashes "at creation of m_test_ or at writing, whatever it fails", so what should I do?