private void ini(int samples, int width, int height, int texformat) { GL2GL3 gl = GLContext.getCurrentGL().getGL2GL3(); this.samples = samples; this.width = width; this.height = height; this.texformat = texformat; gl.glGenRenderbuffers(1, render_buf, 0); gl.glBindRenderbuffer(gl.GL_RENDERBUFFER, render_buf[0]); if (samples > 0) gl.glRenderbufferStorageMultisample( GL2GL3.GL_RENDERBUFFER, samples, texformat, width, height); else gl.glRenderbufferStorage(GL2GL3.GL_RENDERBUFFER, texformat, width, height); }
public void attachDepthRBO(GL2GL3 gl, int width, int height) { int[] id = new int[1]; gl.glGenRenderbuffers(1, id, 0); rboid = id[0]; gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, rboid); gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER, GL2.GL_DEPTH_COMPONENT, width, height); gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0); gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fboid); gl.glFramebufferRenderbuffer( GL2.GL_FRAMEBUFFER, GL2.GL_DEPTH_ATTACHMENT, GL2.GL_RENDERBUFFER, rboid); gl.glEnable(GL2.GL_DEPTH_TEST); gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, 0); }