PDA

View Full Version : Drawing to FBO produces odd "effect." Ideas???



metko
05-04-2009, 01:32 PM
Inside of my JOGL app I'm pulling frames from a QuickTime movie and rendering to a Framebuffer. When displayed, the images seem to be have the lighter pixels replaced with various colors bands. Links to before and after shots below. Anyone care to venture a guess as to what's going on here? Or at least steer me towards some possible causes?

Orig (http://www.flickr.com/photos/38049352@N07/3502264752/in/photostream/)
Result (http://www.flickr.com/photos/38049352@N07/3502264914/in/photostream/)

The code looks about like this:

gl0.glGenRenderbuffersEXT( 1, rb, 0 );
gl0.glGenFramebuffersEXT( 1, fb, 0 );

_framebuffer = fb[0];
_renderbuffer = rb[0];

gl0.glBindRenderbufferEXT( GL.GL_RENDERBUFFER_EXT, _renderbuffer );
gl0.glRenderbufferStorageEXT( GL.GL_RENDERBUFFER_EXT, GL.GL_RGBA, 1024, 1024 );
gl0.glBindFramebufferEXT( GL.GL_FRAMEBUFFER_EXT, _framebuffer );
gl0.glFramebufferRenderbufferEXT( GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT, GL.GL_RENDERBUFFER_EXT, _renderbuffer );

ByteBuffer _buffer = _player.getFrame();
gl0.glDrawPixels( 1024, 1024, GL.GL_RGBA, GL.GL_BYTE, _buffer );

dletozeun
05-04-2009, 02:17 PM
Check data types. It should be:

gl0.glDrawPixels( 1024, 1024, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, _buffer );

Which could explains why white turns black in the second picture.

And use Glubyte as _buffer type (or unsigned char)

metko
05-05-2009, 07:44 AM
Thanks dletozeun! That was the problem. Looking good now.