From d10428def65f42d928b4e93d558d52b42b37e614 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Sat, 20 Oct 2012 20:52:48 +0000 Subject: [PATCH] don't get fron texture name if FBOs are not being used --- core/src/processing/opengl/PGL.java | 47 +++++++++++++++-------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java index c75571602..4a3685e1e 100644 --- a/core/src/processing/opengl/PGL.java +++ b/core/src/processing/opengl/PGL.java @@ -2444,30 +2444,33 @@ public class PGL { protected class PGLListener implements GLEventListener { @Override public void display(GLAutoDrawable adrawable) { - GLFBODrawable fboDrawable = null; - if (toolkit == AWT) { - GLCanvas drCanvas = (GLCanvas)adrawable; - fboDrawable = (GLFBODrawable)drCanvas.getDelegatedDrawable(); -// FBObject fboFront = dr.getFBObject(GL.GL_FRONT); -// FBObject.Colorbuffer colorBuf = fboFront.getColorbuffer(0); -// FBObject.TextureAttachment texFront = (FBObject.TextureAttachment) colorBuf; -// System.out.println("front texture: " + texFront.getName()); - } else { - GLWindow drWindow = (GLWindow)adrawable; - fboDrawable = (GLFBODrawable)drWindow.getDelegatedDrawable(); - } - FBObject.TextureAttachment texAttach = null; - if (fboDrawable != null) { - texAttach = fboDrawable.getTextureBuffer(GL.GL_FRONT); - } - if (texAttach != null) { - fboFrontTex = texAttach.getName(); - fboFrontTexWidth = texAttach.getWidth(); - fboFrontTexHeight = texAttach.getHeight(); - } - drawable = adrawable; context = adrawable.getContext(); + + if (capabilities.isFBO()) { + GLFBODrawable fboDrawable = null; + if (toolkit == AWT) { + GLCanvas drCanvas = (GLCanvas)adrawable; + fboDrawable = (GLFBODrawable)drCanvas.getDelegatedDrawable(); +// FBObject fboFront = dr.getFBObject(GL.GL_FRONT); +// FBObject.Colorbuffer colorBuf = fboFront.getColorbuffer(0); +// FBObject.TextureAttachment texFront = (FBObject.TextureAttachment) colorBuf; +// System.out.println("front texture: " + texFront.getName()); + } else { + GLWindow drWindow = (GLWindow)adrawable; + fboDrawable = (GLFBODrawable)drWindow.getDelegatedDrawable(); + } + FBObject.TextureAttachment texAttach = null; + if (fboDrawable != null) { + texAttach = fboDrawable.getTextureBuffer(GL.GL_FRONT); + } + if (texAttach != null) { + fboFrontTex = texAttach.getName(); + fboFrontTexWidth = texAttach.getWidth(); + fboFrontTexHeight = texAttach.getHeight(); + } + } + gl = context.getGL(); gl2 = gl.getGL2ES2(); try {