|
@@ -1996,28 +1996,13 @@ public final class GLRenderer implements Renderer {
|
|
final int INITIAL = -1;
|
|
final int INITIAL = -1;
|
|
final int MRT_OFF = 100;
|
|
final int MRT_OFF = 100;
|
|
|
|
|
|
- if (fb == null) {
|
|
|
|
- // Set Read/Draw buffers to initial value.
|
|
|
|
- if (context.boundDrawBuf != INITIAL) {
|
|
|
|
- gl2.glDrawBuffer(context.initialDrawBuf);
|
|
|
|
- context.boundDrawBuf = INITIAL;
|
|
|
|
- }
|
|
|
|
- if (context.boundReadBuf != INITIAL) {
|
|
|
|
- gl2.glReadBuffer(context.initialReadBuf);
|
|
|
|
- context.boundReadBuf = INITIAL;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (fb != null) {
|
|
|
|
+
|
|
if (fb.getNumColorBuffers() == 0) {
|
|
if (fb.getNumColorBuffers() == 0) {
|
|
// make sure to select NONE as draw buf
|
|
// make sure to select NONE as draw buf
|
|
- // no color buffer attached.
|
|
|
|
- if (context.boundDrawBuf != NONE) {
|
|
|
|
- gl2.glDrawBuffer(GL.GL_NONE);
|
|
|
|
- context.boundDrawBuf = NONE;
|
|
|
|
- }
|
|
|
|
- if (context.boundReadBuf != NONE) {
|
|
|
|
- gl2.glReadBuffer(GL.GL_NONE);
|
|
|
|
- context.boundReadBuf = NONE;
|
|
|
|
- }
|
|
|
|
|
|
+ // no color buffer attached.
|
|
|
|
+ gl2.glDrawBuffer(GL.GL_NONE);
|
|
|
|
+ gl2.glReadBuffer(GL.GL_NONE);
|
|
} else {
|
|
} else {
|
|
if (fb.getNumColorBuffers() > limits.get(Limits.FrameBufferAttachments)) {
|
|
if (fb.getNumColorBuffers() > limits.get(Limits.FrameBufferAttachments)) {
|
|
throw new RendererException("Framebuffer has more color "
|
|
throw new RendererException("Framebuffer has more color "
|
|
@@ -2042,15 +2027,12 @@ public final class GLRenderer implements Renderer {
|
|
|
|
|
|
intBuf16.flip();
|
|
intBuf16.flip();
|
|
glext.glDrawBuffers(intBuf16);
|
|
glext.glDrawBuffers(intBuf16);
|
|
- context.boundDrawBuf = MRT_OFF + fb.getNumColorBuffers();
|
|
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
RenderBuffer rb = fb.getColorBuffer(fb.getTargetIndex());
|
|
RenderBuffer rb = fb.getColorBuffer(fb.getTargetIndex());
|
|
// select this draw buffer
|
|
// select this draw buffer
|
|
- if (context.boundDrawBuf != rb.getSlot()) {
|
|
|
|
- gl2.glDrawBuffer(GLFbo.GL_COLOR_ATTACHMENT0_EXT + rb.getSlot());
|
|
|
|
- context.boundDrawBuf = rb.getSlot();
|
|
|
|
- }
|
|
|
|
|
|
+ gl2.glDrawBuffer(GLFbo.GL_COLOR_ATTACHMENT0_EXT + rb.getSlot());
|
|
|
|
+ // select this read buffer
|
|
|
|
+ gl2.glReadBuffer(GLFbo.GL_COLOR_ATTACHMENT0_EXT + rb.getSlot());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2098,13 +2080,11 @@ public final class GLRenderer implements Renderer {
|
|
|
|
|
|
if (fb == null) {
|
|
if (fb == null) {
|
|
bindFrameBuffer(null);
|
|
bindFrameBuffer(null);
|
|
- setReadDrawBuffers(null);
|
|
|
|
} else {
|
|
} else {
|
|
if (fb.isUpdateNeeded()) {
|
|
if (fb.isUpdateNeeded()) {
|
|
updateFrameBuffer(fb);
|
|
updateFrameBuffer(fb);
|
|
} else {
|
|
} else {
|
|
bindFrameBuffer(fb);
|
|
bindFrameBuffer(fb);
|
|
- setReadDrawBuffers(fb);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// update viewport to reflect framebuffer's resolution
|
|
// update viewport to reflect framebuffer's resolution
|
|
@@ -2131,12 +2111,7 @@ public final class GLRenderer implements Renderer {
|
|
}
|
|
}
|
|
|
|
|
|
setFrameBuffer(fb);
|
|
setFrameBuffer(fb);
|
|
- if (gl2 != null) {
|
|
|
|
- if (context.boundReadBuf != rb.getSlot()) {
|
|
|
|
- gl2.glReadBuffer(GLFbo.GL_COLOR_ATTACHMENT0_EXT + rb.getSlot());
|
|
|
|
- context.boundReadBuf = rb.getSlot();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
|
|
} else {
|
|
} else {
|
|
setFrameBuffer(null);
|
|
setFrameBuffer(null);
|