Bug 1339 : PGraphics.get() throws IndexOutOfBoundsException in OpenGL
Last modified: 2009-09-29 03:36




Status:
RESOLVED
Resolution:
INVALID -
Priority:
P2
Severity:
normal

 

Reporter:
Spoike
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2009-09-28 03:45
Version: processing-1.0.7
OS: Windows 7 (RC)

While trying to retrieve a PImage from a PGraphics in OpenGL, an
IndexOutOfBoundsException is thrown. However I call the method PGraphics.get(...) it
still throws the exception.

Example code:
PGraphics buf = parent.createGraphics(width, height, OPENGL);
drawStuffOnBuffer(buf);
buf.get(0, 0, buf.width, buf.height);

Stacktrace:
"Exception in thread "Animation Thread" java.lang.IndexOutOfBoundsException:
Required 161604 remaining bytes in buffer, only had 160000
at
com.sun.gluegen.runtime.BufferFactory.rangeCheckBytes(BufferFactory.java:274)
at com.sun.opengl.impl.GLImpl.glReadPixels(GLImpl.java:17480)
at processing.opengl.PGraphicsOpenGL.getImpl(PGraphicsOpenGL.java:2791)
at processing.core.PImage.get(PImage.java:472)"
(snip snip)

When changing the call to buf.get(0,0,10,10); the same exception is thrown but with
different values:

"Exception in thread "Animation Thread" java.lang.IndexOutOfBoundsException:
Required 484 remaining bytes in buffer, only had 400"

The code runs fine on P3D.
Additional Comment #1 From fry 2009-09-29 03:36
createGraphics() with OPENGL is not implemented:
http://processing.org/reference/createGraphics_.html