Java Code Examples for org.lwjgl.opengl.GL30#glDeleteFramebuffers()

The following examples show how to use org.lwjgl.opengl.GL30#glDeleteFramebuffers() . 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: 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 2
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;
}
 
Example 3
Source File: LwjglGLFboGL3.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void glDeleteFramebuffersEXT(IntBuffer param1) {
    checkLimit(param1);
    GL30.glDeleteFramebuffers(param1);
}
 
Example 4
Source File: LwjglGLFboGL3.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void glDeleteFramebuffersEXT(final IntBuffer frameBuffers) {
    checkLimit(frameBuffers);
    GL30.glDeleteFramebuffers(frameBuffers);
}