On Nov 4, 12:20 pm, Pete <
p...@theridouts.co.uk> wrote:
> ...
> So the question is how do i (or what's the best way to) create and
> render to a bitmap that isn't the screen/backbuffer that is normally
> used. I'm guessing i need somehow to use setFramebuffer on the render
> device, but i can't quite get my head around it (if that is even the
> method i should be using).
>
> Any thoughts, ideas or suggestions would be welcome.
Hi, if you are using the GApp framework you are actually rendering to
an off-screen bufffer already. See the docs for Film for a hint of how
you could do it (not using Film) in your own code. Stuff like this:
<pre>
film = Film::create();
fb = Framebuffer::create("Offscreen");
colorBuffer = Texture::createEmpty("Color", renderDevice->width(),
renderDevice->height(), ImageFormat::RGB16F(), Texture::DIM_2D_NPOT,
Texture::Settings::video());
fb->set(Framebuffer::COLOR_ATTACHMENT0, colorBuffer);
fb->set(Framebuffer::DEPTH_ATTACHMENT,
Texture::createEmpty("Depth", renderDevice->width(),
renderDevice->height(), ImageFormat::DEPTH24(), Texture::DIM_2D_NPOT,
Texture::Settings::video()));
</pre>
and then per frame,
<pre>
rd->pushState(fb);
...Rendering code here...
rd->popState();
film->exposeAndRender(rd, colorBuffer);
</pre>
G3D makes it really easy.
Best,
Andrew
>
> Pete