[Closed] set pixels in VFB through 3dsmax SDK
I’m working on a renderer, got things going, and now I have my pixel values as a 1 dimensional array, now I want to put these pixels into the virtual framebuffer during rendering, but I’m having a hard time understanding how to do so, do anyone of you have a example of this?
I do render out to a external file, but I do not want to read that or ‘show’ it, I want to work directly with the framebuffer.
The ‘render’ function gives me access to it, but I’m lost as to how to put the pixels in there.
If you are a renderer plugin, you just need to set the pixels of the bitmap you’re rendering to, and refresh the frame buffer whenever you want to update it.
See the CJRENDER example in \howto\render\cjrender
I knew that I had to do that – but I did not know exactly how,
I did not think of looking in that solution, I looked in the samples solution.
I looked at it last night, and it’s what I need, I’ll try and implement it when I get home from the office today.
It was easier then expected once I saw how to do it, I sat down today and I solved it this way:
//Set the pixel color and alpha to the BMM_Color_64 variable
BMM_Color_64 col64;
col64.r = 255;
col64.g = 0;
col64.b = 0;
col64.a = 255;
//Put the pixel at 1 1 coordinate
tobm->PutPixels(1, 1, 1, &col64);
Do so for all pixels in a loop.
refresh the window when you have ‘put’ all the pixels:
tobm->RefreshWindow(NULL);
It would be more efficient to load it up to a row buffer and call PutPixels once for each row.