On 2/06/14 12:38 AM, Michel Lerenard
wrote:
Hi,
i've been there a few weeks back, the thing to understand if
that the FrameBuffer and the Imf image will always work as if
the data buffer was covering the whole image. You can't restrict
a Framebuffer to work on a part of the image by, for example,
giving it a size.
What you'll need to do to write one tile is to configure the
FrameBuffer with a pointer pointing to the address at which you
buffer would start if it was covering the whole image. The rest
is all pointer arithmetic.
Typically if you're willing to write a tile that covers the
region 256/128 : 287/163 ( a 32*32 tile starting at 256/128 ),
and your data buffer contains data for the current tile only,
call:
out.setFrameBuffer (mybuffer - 256 * 128 * pixelSize ,
pixelSize, tileWidth * pixelSize);
where mybuffer is a char*, pixelSize gives the memory size of an
item. (char = 1, half= 2, float = 4)
Thanks Michel, now I understand why there is the subtraction going
on.
Cheers
--
Nicholas Yue
Graphics - RenderMan, Visualization, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyue
https://vimeo.com/channels/naiadtools
|