OPENGL PGraphics chrashes
in
Core Library Questions
•
2 years ago
Wondering if i am the only one having this problem.
When running the simple Pgraphics example (and any other sketch creating and drawing Pgraphics) the sketch crashes because of an "outOfMemoryError" after just 30 frames...
P3D Works fine. I have assigned 1500MB in the settings.
it works fine when using P3D.
Any ideas ?
here is the code, and the error message:
An OutOfMemoryError means that your code is either using up too much memory
because of a bug (e.g. creating an array that's too large, or unintentionally
loading thousands of images), or that your sketch may need more memory to run.
If your sketch uses a lot of memory (for instance if it loads a lot of data files)
you can increase the memory available to your sketch using the Preferences window.
Exception in thread "Animation Thread" java.lang.OutOfMemoryError
at sun.misc.Unsafe.allocateMemory(Native Method)
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
at com.sun.opengl.util.BufferUtil.newByteBuffer(BufferUtil.java:65)
at com.sun.opengl.util.BufferUtil.copyIntBufferAsByteBuffer(BufferUtil.java:229)
at javax.media.opengl.glu.GLU.copyToByteBuffer(GLU.java:1450)
at javax.media.opengl.glu.GLU.gluBuild2DMipmapsJava(GLU.java:1524)
at javax.media.opengl.glu.GLU.gluBuild2DMipmaps(GLU.java:1581)
at processing.opengl.PGraphicsOpenGL$ImageCache.rebind(PGraphicsOpenGL.java:959)
at processing.opengl.PGraphicsOpenGL.bindTexture(PGraphicsOpenGL.java:767)
at processing.opengl.PGraphicsOpenGL.renderTriangles(PGraphicsOpenGL.java:689)
at processing.core.PGraphics3D.endShape(Unknown Source)
at processing.core.PGraphics.endShape(Unknown Source)
at processing.core.PGraphics.imageImpl(Unknown Source)
at processing.core.PGraphics.image(Unknown Source)
at processing.core.PApplet.image(Unknown Source)
at sketch_dec16a.draw(sketch_dec16a.java:36)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
java.lang.OutOfMemoryError
When running the simple Pgraphics example (and any other sketch creating and drawing Pgraphics) the sketch crashes because of an "outOfMemoryError" after just 30 frames...
P3D Works fine. I have assigned 1500MB in the settings.
it works fine when using P3D.
Any ideas ?
here is the code, and the error message:
- import processing.opengl.*;
PGraphics pg;
void setup() {
size(600, 600,OPENGL);
pg = createGraphics(600, 600, P3D);
}
void draw() {
pg.beginDraw();
pg.background(random(255));
pg.endDraw();
image(pg,0,0);
println(frameCount);
}
An OutOfMemoryError means that your code is either using up too much memory
because of a bug (e.g. creating an array that's too large, or unintentionally
loading thousands of images), or that your sketch may need more memory to run.
If your sketch uses a lot of memory (for instance if it loads a lot of data files)
you can increase the memory available to your sketch using the Preferences window.
Exception in thread "Animation Thread" java.lang.OutOfMemoryError
at sun.misc.Unsafe.allocateMemory(Native Method)
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
at com.sun.opengl.util.BufferUtil.newByteBuffer(BufferUtil.java:65)
at com.sun.opengl.util.BufferUtil.copyIntBufferAsByteBuffer(BufferUtil.java:229)
at javax.media.opengl.glu.GLU.copyToByteBuffer(GLU.java:1450)
at javax.media.opengl.glu.GLU.gluBuild2DMipmapsJava(GLU.java:1524)
at javax.media.opengl.glu.GLU.gluBuild2DMipmaps(GLU.java:1581)
at processing.opengl.PGraphicsOpenGL$ImageCache.rebind(PGraphicsOpenGL.java:959)
at processing.opengl.PGraphicsOpenGL.bindTexture(PGraphicsOpenGL.java:767)
at processing.opengl.PGraphicsOpenGL.renderTriangles(PGraphicsOpenGL.java:689)
at processing.core.PGraphics3D.endShape(Unknown Source)
at processing.core.PGraphics.endShape(Unknown Source)
at processing.core.PGraphics.imageImpl(Unknown Source)
at processing.core.PGraphics.image(Unknown Source)
at processing.core.PApplet.image(Unknown Source)
at sketch_dec16a.draw(sketch_dec16a.java:36)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
java.lang.OutOfMemoryError
1