beginPixelsOp/endPixelsOp are probably not needed when reading a depth

or stencil buffer in PGL.readPixels()
This commit is contained in:
codeanticode
2013-06-23 21:33:47 -04:00
parent 05d6b280ef
commit 559d9a3b97

View File

@@ -3087,6 +3087,8 @@ public class PGL {
public static final int STENCIL_INDEX4 = GL.GL_STENCIL_INDEX4;
public static final int STENCIL_INDEX8 = GL.GL_STENCIL_INDEX8;
public static final int DEPTH_STENCIL = GL.GL_DEPTH_STENCIL;
public static final int FRAMEBUFFER_COMPLETE = GL.GL_FRAMEBUFFER_COMPLETE;
public static final int FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
public static final int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
@@ -3263,11 +3265,15 @@ public class PGL {
// Reading Pixels
public void readPixels(int x, int y, int width, int height, int format, int type, Buffer buffer) {
// The beginPixelsOp/endPixelsOp calls are needed to properly setup the
// framebuffers to read from.
PGraphicsOpenGL.pgCurrent.beginPixelsOp(PGraphicsOpenGL.OP_READ);
boolean needBeginOp = format != STENCIL_INDEX &&
format != DEPTH_COMPONENT && format != DEPTH_STENCIL;
if (needBeginOp) {
PGraphicsOpenGL.pgCurrent.beginPixelsOp(PGraphicsOpenGL.OP_READ);
}
readPixelsImpl(x, y, width, height, format, type, buffer);
PGraphicsOpenGL.pgCurrent.endPixelsOp();
if (needBeginOp) {
PGraphicsOpenGL.pgCurrent.endPixelsOp();
}
}
protected void readPixelsImpl(int x, int y, int width, int height, int format, int type, Buffer buffer) {