Login  Register

Re: Framebuffer not entirely drawing to the screen

Posted by Sven Gothel on Jan 09, 2014; 6:46am
URL: https://forum.jogamp.org/Framebuffer-not-entirely-drawing-to-the-screen-tp4031059p4031133.html

On 12/25/2013 07:03 PM, D3zmodos [via jogamp] wrote:

> Hi,
>
> I'm trying to get started on the use of framebuffers and so I figured I'd try
> write a simple program which just draws to a new framebuffer and then draws
> that to the screen/main framebuffer. The issue is that it appears to only draw
> the colour that I cleared the framebuffer to, not the geometry.
>
> Let me be a little more specific. On my framebuffer I clear to blue, and then
> draw 2 overlapping squares. I then clear the screenbuffer to red and draw the
> contents of the framebuffer to screen-sized quad. What I end up with is an
> entirely blue screen :<
>
> I know that it is in fact drawing *something* from the FBO because the screen
> is blue, not red. I am also sure that the geometry is indeed getting drawn to
> the framebuffer because if I print out the pixel contents of that texture, I
> can see the 2 squares. If I make it draw directly to the screen instead of the
> FBO, I get the correct image.
>
> I am completely stumped, I've been trying to work at this for ages now but to
> no avail so if anybody has anything that might help I would be most appreciative.
>
> Code: http://pastebin.com/B3WwLvKz (Shows the correct image if you comment out
> lines 82, 92, 97-114)
> Shaders: http://pastebin.com/7ufxtjd9
Pls compare w/ working unit test (as always):
  com.jogamp.opengl.test.junit.jogl.demos.es2.FBOMix2DemosES2

Set debug property 'jogl.debug.FBObject' to double check ..

Your 'renderToFBO()' doesn't use a shader, so I assume
a compatibility profile is in use ?
Also: 'renderFBOToScreen()' does not disable the shader ..

In renderFBOToScreen() you do not use FBObject's
'use(..)' and 'unuse(..)' methods (as FBOMix2DemosES2 does).
Are you sure you don't miss any GL state here ?

IMHO try to reuse FBOMix2DemosES2 or similar code
and go from there.

While doing so - please provide us w/ details what went wrong
so we may can fix the FBObject API documentation.
Thank you!

~Sven



signature.asc (911 bytes) Download Attachment