On 04/18/2012 05:34 PM, Wade Walker [via jogamp] wrote:
> If you look at the source code at
>
https://github.com/sgothel/jogl/blob/master/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java,
> you can see it's doing some complex calculations with GL.GL_PACK* and
> GL.GL_UNPACK* to figure out the required buffer size -- it's not as simple as
> just multiplying x and y size and the depth bytes together Those
> GLBuffers.sizeof() methods are invoked by Buffers.rangeCheckBytes(), which is
> invoked by GL4bcImpl.glReadPixels(). All this checking is apparently to
> prevent inadvertently aksing OpenGL to write outside allocated memory by
> passing it a buffer that's too small.
Very good, yup that is it - it secures our binding
and makes it fail fast.
Hence you can do the reverse, asking GLBuffers which size you need,
using it's sizeof operation yourself.
[or set alignment properly]
~Sven