From cf929de6a881ab72b03b99690feec23a8e0413d5 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Tue, 15 May 2007 21:31:43 +0000 Subject: Fixed issue 489: AutoOffScreenCanvas3D: postSwap() is called twice git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@841 ba19aa83-45c5-6ac9-afd3-db810772062c --- src/classes/share/javax/media/j3d/Renderer.java | 38 ++++++++++++++----------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/classes/share/javax/media/j3d/Renderer.java b/src/classes/share/javax/media/j3d/Renderer.java index 21e7534..d6a9805 100644 --- a/src/classes/share/javax/media/j3d/Renderer.java +++ b/src/classes/share/javax/media/j3d/Renderer.java @@ -1422,26 +1422,30 @@ class Renderer extends J3dThread { canvas.endOffScreenRendering(); canvas.offScreenRendering = false; - // do the postSwap for offscreen here - canvas.view.inCanvasCallback = true; - try { - canvas.postSwap(); - } catch (RuntimeException e) { - System.err.println("Exception occurred during Canvas 3D callback:"); - e.printStackTrace(); - } catch (Error e) { - // Issue 264 - catch Error so Renderer doesn't die - System.err.println("Error occurred during Canvas3D callback:"); - e.printStackTrace(); - } + // Issue 489 - don't call postSwap here for auto-offscreen, + // since it will be called later by the SWAP operation + if (canvas.manualRendering) { + // do the postSwap for offscreen here + canvas.view.inCanvasCallback = true; + try { + canvas.postSwap(); + } catch (RuntimeException e) { + System.err.println("Exception occurred during Canvas 3D callback:"); + e.printStackTrace(); + } catch (Error e) { + // Issue 264 - catch Error so Renderer doesn't die + System.err.println("Error occurred during Canvas3D callback:"); + e.printStackTrace(); + } - if (offBufRetained.isByReference()) { - offBufRetained.geomLock.unLock(); - } + if (offBufRetained.isByReference()) { + offBufRetained.geomLock.unLock(); + } - canvas.view.inCanvasCallback = false; + canvas.view.inCanvasCallback = false; - canvas.releaseCtx(); + canvas.releaseCtx(); + } } canvas.endScene(); -- cgit v1.2.3