瀏覽代碼

minor cleanup in GLRenderer

Kirill Vainer 9 年之前
父節點
當前提交
86c2c7f341
共有 1 個文件被更改,包括 10 次插入14 次删除
  1. 10 14
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java

+ 10 - 14
jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java

@@ -1648,15 +1648,13 @@ public final class GLRenderer implements Renderer {
             if (fb.getNumColorBuffers() == 0) {
                 // make sure to select NONE as draw buf
                 // no color buffer attached.
-                if (gl2 != null) {
-                    if (context.boundDrawBuf != NONE) {
-                        gl2.glDrawBuffer(GL.GL_NONE);
-                        context.boundDrawBuf = NONE;
-                    }
-                    if (context.boundReadBuf != NONE) {
-                        gl2.glReadBuffer(GL.GL_NONE);
-                        context.boundReadBuf = NONE;
-                    }
+                if (context.boundDrawBuf != NONE) {
+                    gl2.glDrawBuffer(GL.GL_NONE);
+                    context.boundDrawBuf = NONE;
+                }
+                if (context.boundReadBuf != NONE) {
+                    gl2.glReadBuffer(GL.GL_NONE);
+                    context.boundReadBuf = NONE;
                 }
             } else {
                 if (fb.getNumColorBuffers() > limits.get(Limits.FrameBufferAttachments)) {
@@ -1687,11 +1685,9 @@ public final class GLRenderer implements Renderer {
                 } else {
                     RenderBuffer rb = fb.getColorBuffer(fb.getTargetIndex());
                     // select this draw buffer
-                    if (gl2 != null) {
-                        if (context.boundDrawBuf != rb.getSlot()) {
-                            gl2.glDrawBuffer(GLFbo.GL_COLOR_ATTACHMENT0_EXT + rb.getSlot());
-                            context.boundDrawBuf = rb.getSlot();
-                        }
+                    if (context.boundDrawBuf != rb.getSlot()) {
+                        gl2.glDrawBuffer(GLFbo.GL_COLOR_ATTACHMENT0_EXT + rb.getSlot());
+                        context.boundDrawBuf = rb.getSlot();
                     }
                 }
             }