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

The following examples show how to use org.lwjgl.opengl.GL30#glFramebufferRenderbuffer() . 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: RenderBufferAttachment.java    From LowPolyWater with The Unlicense 5 votes vote down vote up
@Override
public void init(int attachment, int width, int height, int samples) {
	int buffer = GL30.glGenRenderbuffers();
	super.setBufferId(buffer);
	GL30.glBindRenderbuffer(GL30.GL_RENDERBUFFER, buffer);
	GL30.glRenderbufferStorageMultisample(GL30.GL_RENDERBUFFER, samples, format, width, height);
	GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, attachment, GL30.GL_RENDERBUFFER, buffer);
}
 
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 glFramebufferRenderbufferEXT(int param1, int param2, int param3, int param4) {
    GL30.glFramebufferRenderbuffer(param1, param2, param3, param4);
}
 
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 glFramebufferRenderbufferEXT(final int target, final int attachment, final int renderBufferTarget,
                                         final int renderBuffer) {
    GL30.glFramebufferRenderbuffer(target, attachment, renderBufferTarget, renderBuffer);
}