Java Code Examples for org.lwjgl.opengl.GL11#glDeleteTextures()

The following examples show how to use org.lwjgl.opengl.GL11#glDeleteTextures() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LegacyCurveRenderState.java    From opsu with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Cleanup any OpenGL objects that may have been initialized.
 */
private void shutdown() {
	if (gradientTexture != 0) {
		GL11.glDeleteTextures(gradientTexture);
		gradientTexture = 0;
	}

	if (program != 0) {
		GL20.glDeleteProgram(program);
		program = 0;
		attribLoc = 0;
		texCoordLoc = 0;
		colLoc = 0;
		colBorderLoc = 0;
		texLoc = 0;
	}
}
 
Example 2
Source File: CurveRenderState.java    From opsu-dance with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Cleanup any OpenGL objects that may have been initialized.
 */
private void shutdown() {
	if (gradientTexture != 0) {
		GL11.glDeleteTextures(gradientTexture);
		gradientTexture = 0;
	}

	if (program != 0) {
		GL20.glDeleteProgram(program);
		program = 0;
		attribLoc = 0;
		texCoordLoc = 0;
		colLoc = 0;
		colBorderLoc = 0;
		texLoc = 0;
	}
}
 
Example 3
Source File: Texture.java    From mapwriter with MIT License 5 votes vote down vote up
public synchronized void close() {
	if (this.id != 0) {
		try {
			GL11.glDeleteTextures(this.id);
		} catch (NullPointerException e) {
			MwUtil.log("MwTexture.close: null pointer exception (texture %d)", this.id);
		}
		this.id = 0;
	}
}
 
Example 4
Source File: Rendertarget.java    From opsu with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Destroy the OpenGL objects associated with this Rendertarget. Do not try
 * to use this rendertarget with OpenGL after calling this method.
 */
public void destroyRTT() {
	EXTFramebufferObject.glDeleteFramebuffersEXT(fboID);
	EXTFramebufferObject.glDeleteRenderbuffersEXT(depthBufferID);
	GL11.glDeleteTextures(textureID);
	GL15.glDeleteBuffers(vboID);
}
 
Example 5
Source File: FramebufferTextureRenderer.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
private void deleteBuffers() {
	IntBuffer tmp = BufferUtils.createIntBuffer(4);
	tmp.put(0, fb_id);
	EXTFramebufferObject.glDeleteFramebuffersEXT(tmp);
	tmp.put(0, rb_id);
	GL11.glDeleteTextures(tmp);
}
 
Example 6
Source File: RocketEventHandler.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public static void destroyOrbitalTextures(World world) {
	if(!Configuration.skyOverride && !(world.provider instanceof IPlanetaryProvider)) {
		world.provider.setSkyRenderer(prevRenderHanlder);
		prevRenderHanlder = null;
	}

	if(earth != null)
		GL11.glDeleteTextures(earth.getTextureId());
	if(outerBounds != null)
		GL11.glDeleteTextures(outerBounds.getTextureId());
	outerBounds = null;
	earth = null;
	mapReady = false;
}
 
Example 7
Source File: GuiOreMappingSatellite.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void onGuiClosed() {
	super.onGuiClosed();
	//Delete texture and stop any mapping on close
	GL11.glDeleteTextures(texture.getTextureId());
	if(currentMapping != null)
		currentMapping.interrupt();
}
 
Example 8
Source File: GTexture.java    From ldparteditor with MIT License 5 votes vote down vote up
public void dispose(OpenGLRenderer renderer) {
    if (OpenGlDisposed.containsKey(renderer)) {
        boolean disposed = OpenGlDisposed.get(renderer);
        int ID = OpenGlID.get(renderer);
        int ID_glossmap = OpenGlID_glossmap.get(renderer);
        int ID_cubemap = OpenGlID_cubemap.get(renderer);
        int ID_cubemapMatte = OpenGlID_cubemapMatte.get(renderer);
        int ID_cubemapMetal = OpenGlID_cubemapMetal.get(renderer);
        if (!disposed) {
            uvCache.clear();
            cacheUsage.clear();
            if (ID != -1)
                GL11.glDeleteTextures(ID);
            if (ID_glossmap != -1)
                GL11.glDeleteTextures(ID_glossmap);
            if (renderer.containsOnlyCubeMaps() && renderer.getC3D().getRenderMode() != 5) {
                if (ID_cubemap != -1) GL11.glDeleteTextures(ID_cubemap);
                if (ID_cubemapMatte != -1) GL11.glDeleteTextures(ID_cubemapMatte);
                if (ID_cubemapMetal != -1) GL11.glDeleteTextures(ID_cubemapMetal);
            }
            OpenGlDisposed.put(renderer, true);
            OpenGlID.put(renderer, -1);
            OpenGlID_glossmap.put(renderer, -1);
            OpenGlID_cubemap.put(renderer, -1);
            OpenGlID_cubemapMatte.put(renderer, -1);
            OpenGlID_cubemapMetal.put(renderer, -1);
        }
    }
}
 
Example 9
Source File: FrameBufferContainer.java    From LookingGlass with GNU General Public License v3.0 5 votes vote down vote up
private synchronized void freeFrameBuffer() {
	try {
		if (this.texture != 0) GL11.glDeleteTextures(this.texture);
		this.texture = 0;
		if (depthBuffer != 0) EXTFramebufferObject.glDeleteRenderbuffersEXT(depthBuffer);
		depthBuffer = 0;
		if (this.framebuffer != 0) EXTFramebufferObject.glDeleteFramebuffersEXT(this.framebuffer);
		this.framebuffer = 0;
	} catch (Exception e) {
		// Just in case, we make sure we don't crash. Because crashing is bad.
		LoggerUtils.error("Error while cleaning up a world view frame buffer.");
	}
}
 
Example 10
Source File: Rendertarget.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Destroy the OpenGL objects associated with this Rendertarget. Do not try
 * to use this rendertarget with OpenGL after calling this method.
 */
public void destroyRTT() {
	EXTFramebufferObject.glDeleteFramebuffersEXT(fboID);
	EXTFramebufferObject.glDeleteRenderbuffersEXT(depthBufferID);
	GL11.glDeleteTextures(textureID);
	GL15.glDeleteBuffers(vboID);
}
 
Example 11
Source File: OffscreenBuffer.java    From LWJGUI with MIT License 5 votes vote down vote up
public void cleanup() {
	GL11.glDeleteTextures(texId);
	if (fboId != 0) {
		GL30.glDeleteFramebuffers(fboId);
	}
	if (quad != null) {
		quad.cleanup();
	}
	if (quadShader != null) {
		quadShader.cleanup();
	}
}
 
Example 12
Source File: ImmediateModeOGLRenderer.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @see org.newdawn.slick.opengl.renderer.SGL#glDeleteTextures(java.nio.IntBuffer)
 */
public void glDeleteTextures(IntBuffer buffer) {
	GL11.glDeleteTextures(buffer);
}
 
Example 13
Source File: CustomTexture.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
public void unload() {
    if (!unloaded) {
        GL11.glDeleteTextures(textureId);
        unloaded = true;
    }
}
 
Example 14
Source File: ImageAtlas.java    From AnyaBasic with MIT License 4 votes vote down vote up
public void shutDown()
{
	GL11.glDeleteTextures( textureID );
}
 
Example 15
Source File: ModuleOreMapper.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
private void resetTexture() {
	GL11.glDeleteTextures(texture.getTextureId());
	texture = new ClientDynamicTexture(Math.max(scanSize/radius,1),Math.max(scanSize/radius,1));
}
 
Example 16
Source File: GuiOreMappingSatellite.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
private void resetTexture() {
	GL11.glDeleteTextures(texture.getTextureId());
	texture = new ClientDynamicTexture(Math.max(scanSize/radius,1),Math.max(scanSize/radius,1));
}
 
Example 17
Source File: Texture.java    From OpenGL-Animation with The Unlicense 4 votes vote down vote up
public void delete() {
	GL11.glDeleteTextures(textureId);
}
 
Example 18
Source File: LWJGL15DrawContext.java    From settlers-remake with MIT License 4 votes vote down vote up
@Override
public void deleteTexture(TextureHandle textureHandle) {
	GL11.glDeleteTextures(textureHandle.getInternalId());
}
 
Example 19
Source File: TextureAttachment.java    From LowPolyWater with The Unlicense 4 votes vote down vote up
@Override
public void delete() {
	GL11.glDeleteTextures(getBufferId());
}
 
Example 20
Source File: OffscreenBuffer.java    From LWJGUI with MIT License 4 votes vote down vote up
/**
 * Resize the buffer to desired width/height
 * @param width
 * @param height
 * @return
 */
public boolean resize(int width, int height) {
	if (this.width == width && this.height == height) {
		return false;
	}
	
	this.width = width;
	this.height = height;

	// resize the texture
	if (texId != 0) {
		GL11.glDeleteTextures(texId);
		GL30.glDeleteFramebuffers(fboId);
		GL30.glDeleteRenderbuffers(renderId);
		texId = 0;
		fboId = 0;
		renderId = 0;
	}
	
	// Create texture
	if ( texId == 0 )
		texId = GL11.glGenTextures();
	GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId);
	GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, 0);
	
	// Set default filtering
	GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
	GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
	GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
	GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
	
	// update the framebuf
	if (fboId == 0)
		fboId = GL30.glGenFramebuffers();
	GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboId);
	GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texId, 0);
	
	// The depth buffer
	if ( renderId == 0 )
		renderId = GL30.glGenRenderbuffers();
	GL30.glBindRenderbuffer(GL30.GL_RENDERBUFFER, renderId);
	GL30.glRenderbufferStorage(GL30.GL_RENDERBUFFER, GL11.GL_DEPTH_COMPONENT, width, height);
	GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL30.GL_RENDERBUFFER, renderId);
	
	// remove the old quad
	quadDirty = true;
	

	GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
	
	return true;
}