public static void cleanAllVBOs(final Renderer deleter) { final Multimap<Object, Integer> idMap = ArrayListMultimap.create(); // gather up expired vbos... these don't exist in our cache gatherGCdIds(idMap); // Walk through the cached items and delete those too. for (final AbstractBufferData<?> buf : _identityCache.keySet()) { if (buf._vboIdCache != null) { if (Constants.useMultipleContexts) { final Set<Object> contextObjects = buf._vboIdCache.getContextObjects(); for (final Object o : contextObjects) { // Add id to map idMap.put(o, buf.getVBOID(o)); } } else { idMap.put(ContextManager.getCurrentContext().getGlContextRep(), buf.getVBOID(null)); } buf._vboIdCache.clear(); } } handleVBODelete(deleter, idMap); }
public void deleteVBOs(final AbstractBufferData<?> buffer) { if (buffer == null) { return; } // ask for the current state record final RenderContext context = ContextManager.getCurrentContext(); final int id = buffer.getVBOID(context.getGlContextRep()); if (id == 0) { // Not on card... return. return; } buffer.removeVBOID(context.getGlContextRep()); final IntBuffer idBuff = BufferUtils.createIntBuffer(1); idBuff.put(id); idBuff.flip(); ARBBufferObject.glDeleteBuffersARB(idBuff); }
public void deleteVBOs(final AbstractBufferData<?> buffer) { if (buffer == null) { return; } final GL gl = GLContext.getCurrentGL(); // ask for the current state record final RenderContext context = ContextManager.getCurrentContext(); final int id = buffer.getVBOID(context.getGlContextRep()); if (id == 0) { // Not on card... return. return; } buffer.removeVBOID(context.getGlContextRep()); final IntBuffer idBuff = BufferUtils.createIntBuffer(1); idBuff.put(id); idBuff.flip(); gl.glDeleteBuffers(1, idBuff); }
public static int setupVBO(final AbstractBufferData<? extends Buffer> data, final RenderContext context) { if (data == null) { return 0; } final GL gl = GLContext.getCurrentGL(); final RendererRecord rendRecord = context.getRendererRecord(); int vboID = data.getVBOID(context.getGlContextRep()); if (vboID != 0) { updateVBO(data, rendRecord, vboID, 0); return vboID; } final Buffer dataBuffer = data.getBuffer(); if (dataBuffer != null) { // XXX: should we be rewinding? Maybe make that the programmer's responsibility. dataBuffer.rewind(); vboID = makeVBOId(); data.setVBOID(context.getGlContextRep(), vboID); rendRecord.invalidateVBO(); JoglRendererUtil.setBoundVBO(rendRecord, vboID); gl.glBufferData(GL.GL_ARRAY_BUFFER, dataBuffer.limit() * data.getByteCount(), dataBuffer, getGLVBOAccessMode(data.getVboAccessMode())); } else { throw new Ardor3dException("Attempting to create a vbo id for an AbstractBufferData with no Buffer value."); } return vboID; }
int vboID = data.getVBOID(context.getGlContextRep()); if (vboID != 0) { updateVBO(data, rendRecord, vboID, 0);