diff options
-rw-r--r-- | src/main/java/org/jogamp/java3d/GraphicsContext3D.java | 4 | ||||
-rw-r--r-- | src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java | 2 | ||||
-rw-r--r-- | src/main/java/org/jogamp/java3d/Renderer.java | 56 |
3 files changed, 60 insertions, 2 deletions
diff --git a/src/main/java/org/jogamp/java3d/GraphicsContext3D.java b/src/main/java/org/jogamp/java3d/GraphicsContext3D.java index 2595d8c..c2c43f9 100644 --- a/src/main/java/org/jogamp/java3d/GraphicsContext3D.java +++ b/src/main/java/org/jogamp/java3d/GraphicsContext3D.java @@ -1730,7 +1730,9 @@ public int numSounds() { canvas3d.drawingSurfaceObject.unLock(); return; } - + // createNewContext finishes with a release, re-make current so the init calls below work + canvas3d.makeCtxCurrent(); + canvas3d.ctxTimeStamp = VirtualUniverse.mc.getContextTimeStamp(); canvas3d.screen.renderer.listOfCtxs.add(canvas3d.ctx); diff --git a/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java b/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java index 7e4cccf..b9d8066 100644 --- a/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java +++ b/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java @@ -33,7 +33,7 @@ abstract class Jogl2es2DEPPipeline extends Pipeline + "Decaling is not supported. \n"// + "Model Clip is not supported and must be reimplemented in shaders \n"// + "QuadArray or IndexedQuadArray cannot be supported. \n"// - + "Texture Coordinate generation cannot be supported. \n" // + + "Texture Coordinate generation ignored, must be done in shaders. \n" // + "Texture Lod, Filter, Sharpen and Combine cannot be supported. \n"// + "Texture3D cannot be supported. \n"// + "Accum style anti-aliasing cannot be supported. \n"// diff --git a/src/main/java/org/jogamp/java3d/Renderer.java b/src/main/java/org/jogamp/java3d/Renderer.java index 2899318..01958e3 100644 --- a/src/main/java/org/jogamp/java3d/Renderer.java +++ b/src/main/java/org/jogamp/java3d/Renderer.java @@ -620,7 +620,62 @@ ArrayList<TextureRetained> textureIDResourceTable = new ArrayList<TextureRetaine if (canvas.isFatalError()) { continue; } + if (canvas.ctx == null) { + synchronized (VirtualUniverse.mc.contextCreationLock) { + canvas.ctx = canvas.createNewContext(null, false); + + if (canvas.ctx == null) { + canvas.drawingSurfaceObject.unLock(); + // Issue 260 : indicate fatal error and notify error listeners + canvas.setFatalError(); + RenderingError err = + new RenderingError(RenderingError.CONTEXT_CREATION_ERROR, + J3dI18N.getString("Renderer7")); + err.setCanvas3D(canvas); + err.setGraphicsDevice(canvas.graphicsConfiguration.getDevice()); + notifyErrorListeners(err); + + break doneRender; + } + // createNewContext finishes with a release, re-make current so the init calls below work + canvas.makeCtxCurrent(); + + if (canvas.graphics2D != null) { + canvas.graphics2D.init(); + } + + canvas.ctxTimeStamp = VirtualUniverse.mc.getContextTimeStamp(); + canvas.screen.renderer.listOfCtxs.add(canvas.ctx); + canvas.screen.renderer.listOfCanvases.add(canvas); + + // enable separate specular color + canvas.enableSeparateSpecularColor(); + } + + // create the cache texture state in canvas + // for state download checking purpose + if (canvas.texUnitState == null) { + canvas.createTexUnitState(); + } + canvas.drawingSurfaceObject.contextValidated(); + canvas.screen.renderer.currentCtx = canvas.ctx; + canvas.screen.renderer.currentDrawable = canvas.drawable; + canvas.graphicsContext3D.initializeState(); + canvas.ctxChanged = true; + canvas.canvasDirty = 0xffff; + // Update Appearance + canvas.graphicsContext3D.updateState(canvas.view.renderBin, RenderMolecule.SURFACE); + + + canvas.currentLights = new LightRetained[canvas.getNumCtxLights(canvas.ctx)]; + + for (j=0; j<canvas.currentLights.length; j++) { + canvas.currentLights[j] = null; + } + } + + canvas.makeCtxCurrent(); try { switch (command) { @@ -757,6 +812,7 @@ ArrayList<TextureRetained> textureIDResourceTable = new ArrayList<TextureRetaine } m[nmesg++].decRefcount(); + canvas.releaseCtx(); } else { // retained mode rendering long startRenderTime = 0L; if (MasterControl.isStatsLoggable(Level.INFO)) { |