protected void forgetTextures(GL gl) { if(gl == null) { completedTextures = -1; } else { if(textures != null) { gl.glDeleteTextures(textures.length, textures, 0); textures = null; } completedTextures = 0; } }
/** * Destroys the native resources used by this texture object. * * @throws GLException if any OpenGL-related errors occurred */ public void destroy(final GL gl) throws GLException { if(0!=texID) { gl.glDeleteTextures(1, new int[] {texID}, 0); texID = 0; } }
public void freeDeviceResources( GL gl ) { if ( dTextureHandle != 0 ) { gl.glDeleteTextures( 1, ints( dTextureHandle ), 0 ); } dSet = null; dBuffer = null; dRowLength = 0; dRowCount = 0; dTextureHandle = 0; }
public void dispose( GL gl ) { gl.glDeleteTextures( 1, ints( textureHandle ), 0 ); } }
/** * Remove the texture from the context. * * @param gl * @param refID * of the fragment which needed this texture tile. */ public void disable( GL gl, int refID ) { synchronized ( LOCK ) { if ( !referencedRenderFragments.contains( refID ) ) { LOG.warn( "Trying to remove a reference, which was not registered, this is strange: " + textureID ); if ( textureID == null ) { return; } } referencedRenderFragments.remove( refID ); // numReferences--; // if ( numReferences < 0 ) { // throw new RuntimeException(); // } if ( textureID != null ) { if ( referencedRenderFragments.isEmpty() /* || numReferences == 0 */) { LOG.debug( "disabling and freeing texture memory." ); gl.glDeleteTextures( 1, textureID, 0 ); textureID = null; } } } }
@Override public void free(final GL gl) { final int[] name = new int[] { getName() }; if( 0 != name[0] ) { if(DEBUG) { System.err.println("Attachment.free.0: "+this); } gl.glDeleteTextures(1, name, 0); setName(0); } }
public void dispose( GL gl ) { gl.glDeleteTextures( 1, ints( textureHandle ), 0 ); gl.glDeleteBuffers( 2, ints( entriesAlignHandle, entriesBoundsHandle ), 0 ); } }
public static void deleteTextureIds(final Collection<Integer> ids) { final GL gl = GLContext.getCurrentGL(); // ask for the current state record final RenderContext context = ContextManager.getCurrentContext(); final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(StateType.Texture); final IntBuffer idBuffer = BufferUtils.createIntBuffer(ids.size()); idBuffer.clear(); for (final Integer i : ids) { if (i != null) { idBuffer.put(i); record.removeTextureRecord(i); } } idBuffer.flip(); if (idBuffer.remaining() > 0) { gl.glDeleteTextures(idBuffer.remaining(), idBuffer); } }
public static void deleteTexture(final Texture texture) { final GL gl = GLContext.getCurrentGL(); // ask for the current state record final RenderContext context = ContextManager.getCurrentContext(); final TextureStateRecord record = (TextureStateRecord) context.getStateRecord(StateType.Texture); final Integer id = texture.getTextureIdForContextAsInteger(context.getGlContextRep()); if (id.intValue() == 0) { // Not on card... return. return; } final IntBuffer idBuffer = BufferUtils.createIntBuffer(1); idBuffer.clear(); idBuffer.put(id.intValue()); idBuffer.rewind(); gl.glDeleteTextures(idBuffer.limit(), idBuffer); record.removeTextureRecord(id); texture.removeFromIdCache(context.getGlContextRep()); }
gl.glDeleteTextures(1, name, 0); setName(0); throw new GLException("GL Error "+toHexString(glerr)+" while creating (pre TexImage2D "+preTexImage2D+") "+this);