/** * Causes our shared texture renderer - used to draw cached versions of all frames - to be recreated on the next * render loop. */ public static void resetTextureRenderer(final Object queueKey) { final Callable<Void> exe = new Callable<Void>() { public Void call() { if (UIContainer._textureRenderer != null) { UIContainer._textureRenderer.cleanup(); } UIContainer._textureRenderer = null; return null; } }; GameTaskQueueManager.getManager(queueKey).render(exe); }
/** * Causes our shared texture renderer - used to draw cached versions of all containers - to be recreated on the next * render loop. */ public static void resetTextureRenderer(final Object queueKey) { final Callable<Void> exe = new Callable<Void>() { public Void call() { if (UIContainer._textureRenderer != null) { UIContainer._textureRenderer.cleanup(); } UIContainer._textureRenderer = null; return null; } }; GameTaskQueueManager.getManager(queueKey).render(exe); }
private void changeTexture() { try { final int result = _textureChooser.showOpenDialog(this); if (result == JFileChooser.CANCEL_OPTION) { return; } final File textFile = _textureChooser.getSelectedFile(); _prefs.put("texture_dir", textFile.getParent()); _newTexture = textFile; GameTaskQueueManager.getManager(ParticleEditorFrame.GLOBAL_CONTEXT).render(new Callable<Object>() { public Object call() throws Exception { loadApplyTexture(); return null; } }); final ImageIcon icon = new ImageIcon(getToolkit().createImage(textFile.getAbsolutePath())); _imageLabel.setIcon(icon); validate(); } catch (final Exception ex) { logger.logp(Level.SEVERE, this.getClass().toString(), "changeTexture()", "Exception", ex); } }
private static void handleTextureDelete(final Renderer deleter, final Multimap<Object, Integer> idMap, final Map<Object, Future<Void>> futureStore) { Object currentGLRef = null; // Grab the current context, if any. if (deleter != null && ContextManager.getCurrentContext() != null) { currentGLRef = ContextManager.getCurrentContext().getGlContextRep(); } // For each affected context... for (final Object glref : idMap.keySet()) { // If we have a deleter and the context is current, immediately delete if (currentGLRef != null && (!Constants.useMultipleContexts || glref.equals(currentGLRef))) { deleter.deleteTextureIds(idMap.get(glref)); } // Otherwise, add a delete request to that context's render task queue. else { final Future<Void> future = GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)) .render(new RendererCallable<Void>() { public Void call() throws Exception { getRenderer().deleteTextureIds(idMap.get(glref)); return null; } }); if (futureStore != null) { futureStore.put(glref, future); } } } }
private static void handleTextureDelete(final ITextureUtils utils, final Multimap<RenderContextRef, Integer> idMap, final Map<RenderContextRef, Future<Void>> futureStore) { RenderContextRef currentGLRef = null; // Grab the current context, if any. if (utils != null && ContextManager.getCurrentContext() != null) { currentGLRef = ContextManager.getCurrentContext().getGlContextRef(); } // For each affected context... for (final RenderContextRef contextRef : idMap.keySet()) { // If we have a deleter and the context is current, immediately delete if (currentGLRef != null && (!Constants.useMultipleContexts || contextRef.equals(currentGLRef))) { utils.deleteTextureIds(idMap.get(contextRef)); } // Otherwise, add a delete request to that context's render task queue. else { final Future<Void> future = GameTaskQueueManager.getManager(ContextManager.getContextForRef(contextRef)) .render(new RendererCallable<Void>() { public Void call() throws Exception { getRenderer().getTextureUtils().deleteTextureIds(idMap.get(contextRef)); return null; } }); if (futureStore != null) { futureStore.put(contextRef, future); } } } }
private static void handleVBODelete(final Renderer deleter, final Multimap<Object, Integer> idMap) { Object currentGLRef = null; // Grab the current context, if any. if (deleter != null && ContextManager.getCurrentContext() != null) { currentGLRef = ContextManager.getCurrentContext().getGlContextRep(); } // For each affected context... for (final Object glref : idMap.keySet()) { // If we have a deleter and the context is current, immediately delete if (deleter != null && glref.equals(currentGLRef)) { deleter.deleteVBOs(idMap.get(glref)); } // Otherwise, add a delete request to that context's render task queue. else { GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)).render( new RendererCallable<Void>() { public Void call() throws Exception { getRenderer().deleteVBOs(idMap.get(glref)); return null; } }); } } }
private static void handleVAODelete(final IShaderUtils utils, final Multimap<RenderContextRef, Integer> idMap) { RenderContextRef currentGLRef = null; // Grab the current context, if any. if (utils != null && ContextManager.getCurrentContext() != null) { currentGLRef = ContextManager.getCurrentContext().getGlContextRef(); } // For each affected context... for (final RenderContextRef ref : idMap.keySet()) { // If we have a deleter and the context is current, immediately delete if (utils != null && ref.equals(currentGLRef)) { utils.deleteVertexArrays(idMap.get(ref)); } // Otherwise, add a delete request to that context's render task queue. else { GameTaskQueueManager.getManager(ContextManager.getContextForRef(ref)) .render(new RendererCallable<Void>() { public Void call() throws Exception { getRenderer().getShaderUtils().deleteVertexArrays(idMap.get(ref)); return null; } }); } } }
private static void handleVBODelete(final IShaderUtils utils, final Multimap<RenderContextRef, Integer> idMap) { Object currentGLRef = null; // Grab the current context, if any. if (utils != null && ContextManager.getCurrentContext() != null) { currentGLRef = ContextManager.getCurrentContext().getGlContextRef(); } // For each affected context... for (final RenderContextRef glref : idMap.keySet()) { // If we have a deleter and the context is current, immediately delete if (utils != null && glref.equals(currentGLRef)) { utils.deleteBuffers(idMap.get(glref)); } // Otherwise, add a delete request to that context's render task queue. else { GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)) .render(new RendererCallable<Void>() { public Void call() throws Exception { getRenderer().getShaderUtils().deleteBuffers(idMap.get(glref)); return null; } }); } } }
private static void handleDisplayListDelete(final Renderer deleter, final Multimap<Object, Integer> idMap) { Object currentGLRef = null; // Grab the current context, if any. if (deleter != null && ContextManager.getCurrentContext() != null) { currentGLRef = ContextManager.getCurrentContext().getGlContextRep(); } // For each affected context... for (final Object glref : idMap.keySet()) { // If we have a deleter and the context is current, immediately delete if (deleter != null && glref.equals(currentGLRef)) { deleter.deleteDisplayLists(idMap.get(glref)); } // Otherwise, add a delete request to that context's render task queue. else { GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)).render( new RendererCallable<Void>() { public Void call() throws Exception { getRenderer().deleteDisplayLists(idMap.get(glref)); return null; } }); } } } }