Example usage for org.lwjgl.opengl GL11 glDeleteTextures

List of usage examples for org.lwjgl.opengl GL11 glDeleteTextures

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glDeleteTextures.

Prototype

public static void glDeleteTextures(@NativeType("GLuint const *") int[] textures) 

Source Link

Document

Array version of: #glDeleteTextures DeleteTextures

Usage

From source file:espresso3d.engine.fileloaders.E3DImageLoader.java

License:Open Source License

public static void unloadImageFromGL(int glTextureID) {
    IntBuffer buf = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
    buf.put(glTextureID);/*from   w  w  w  .  j  a  v  a 2  s  .co m*/
    GL11.glDeleteTextures(buf);
}

From source file:fi.conf.ae.gl.texture.GLTextureRoutines.java

License:LGPL

/**
 * Deallocate OpenGL texture ID's so they can be reused.
 * // w w  w  .jav  a2  s . co  m
 * @param textureIDs - Integer array of texture ID's to be "returned" to OpenGL.
 */
public static void deallocateGLTextureIDs(int[] textureIDs) {

    if (textureIDs.length > textureIDbuffer.capacity()) {
        textureIDbuffer = BufferUtils.createIntBuffer(textureIDs.length);
    }

    textureIDbuffer.clear();

    GL11.glDeleteTextures(textureIDbuffer);
}

From source file:fr.def.iss.vd2.lib_v3d.element.TextureHandler.java

License:Open Source License

@Override
public void dispose() {
    GL11.glDeleteTextures(IntBuffer.wrap(new int[] { texture.getGlId() }));
    texture.setValid(false);
}

From source file:fr.ign.cogit.geoxygene.appli.gl.setters.GLProgramUniformSetter.java

License:Open Source License

public boolean set(NamedRenderingParametersMap cParams, GLProgram program) throws GLException {
    logger.debug("Apply preSet actions");
    boolean succ = true;
    if (!this.userSetters.isEmpty()) {
        succ &= this.preSetActions(cParams, program);
    }/*w  w  w  .j a  v  a 2 s  . c  o  m*/
    if (!succ)
        return false;
    int texcount = 0;
    Collection<GLUniform> uniforms = program.getUniforms();
    for (GLUniform uniform : uniforms) {
        Object uniform_value = cParams.containsParameterWithName(uniform.getName())
                ? cParams.getByName(uniform.getName())
                : cParams.getByUniformRef(uniform.getName());
        //If the uniform is a texture, we have to retrieve it from the TextureManager
        if (uniform.getGlType() == GL20.GL_SAMPLER_2D || uniform.getGlType() == GL20.GL_SAMPLER_1D) {
            if (uniform_value != null && uniform_value instanceof URI) {
                GLTexture btex = TextureManager.retrieveTexture((URI) uniform_value);
                if (btex == null) {
                    logger.debug("Setting the texture uniform " + uniform.getName()
                            + " failed because no texture was found: maybe the texture is not yet ready?");
                } else {
                    btex.setTextureSlot(uniform.getName(), GL13.GL_TEXTURE0 + texcount);
                    if (!btex.initializeRendering(program.getProgramId())) {
                        logger.error("An error occured while initilializing the texture " + uniform);
                        GL11.glDeleteTextures(GL13.GL_TEXTURE0 + texcount);
                        succ = false;
                    }
                    program.setUniform(uniform.getName(), texcount);
                    texcount++;
                }

            } else {
                logger.error("Setting the texture uniform " + uniform.getName()
                        + " failed : there is no parameter with such name or its value is null.");
            }
        } else {
            if (uniform_value != null) {
                program.setUniform(uniform.getName(), uniform_value);
                GLTools.glCheckError("When setting uniform " + uniform.getName() + " : " + uniform_value);

            } else {
                logger.debug("Uniform " + uniform.getName() + " has no value set ");
            }
        }
    }
    if (!this.userSetters.isEmpty()) {
        succ &= this.postSetActions(cParams, program);
    }
    return succ;
}

From source file:fr.kouignamann.cube.core.utils.TextureUtils.java

public static void destroyTextures(int[] textureIds) {
    if (textureIds == null) {
        return;//from w  ww .  j a  v  a2 s.com
    }
    for (int textureId : textureIds) {
        GL11.glDeleteTextures(textureId);
    }
}

From source file:gui.lwjgl.GUIElementLoader.java

/**
 * Cleans the memory of all VAO's and VBO's.
 *///from  w w w .  j  a  v a2s.  c  o  m
public static void cleanUp() {
    vaos.forEach(x -> GL30.glDeleteVertexArrays(x));
    vbos.forEach(x -> GL15.glDeleteBuffers(x));
    textures.values().forEach(x -> GL11.glDeleteTextures(x.getTextureID()));
}

From source file:hellfirepvp.astralsorcery.client.util.resource.BindableResource.java

License:Open Source License

@Deprecated
public void invalidateAndReload() {
    if (resource != null)
        GL11.glDeleteTextures(resource.getGlTextureId());
    resource = null;
}

From source file:illarion.graphics.lwjgl.TextureAtlasLWJGL.java

License:Open Source License

/**
 * Remove the texture from the video ram of the graphic card.
 *//*from  ww  w .  j  a  v  a2  s  .c  om*/
@Override
protected void removeFromVRam() {
    final int texID = getTextureID();
    if (texID != 0) {
        texIDBuffer.rewind();
        texIDBuffer.put(texID);

        GL11.glDeleteTextures(texIDBuffer);
        setTextureID(0);
    }
}

From source file:im.bci.jnuit.lwjgl.assets.AnimationCollectionWeakReference.java

License:Open Source License

void delete() {
    if (null != textureIds) {
        logger.log(Level.FINE, "Unload animation {0}", name);
        GL11.glDeleteTextures(textureIds);
        textureIds = null;/*  w  ww  .j ava2 s  . c o  m*/
    }
}

From source file:im.bci.jnuit.lwjgl.assets.TextureWeakReference.java

License:Open Source License

void delete() {
    if (null != textureId) {
        logger.log(Level.FINE, "Unload texture {0}", name);
        ByteBuffer temp = ByteBuffer.allocateDirect(4);
        temp.order(ByteOrder.nativeOrder());
        IntBuffer intBuffer = temp.asIntBuffer();
        intBuffer.put(textureId);//from w  ww . ja v a 2s.  c o m
        GL11.glDeleteTextures(intBuffer);
        textureId = null;
    }
}