Search in sources :

Example 1 with WebGLRenderbuffer

use of com.google.gwt.webgl.client.WebGLRenderbuffer in project playn by threerings.

the class WebGLDemo method createFramebuffer.

private WebGLFramebuffer createFramebuffer(int width, int height) {
    WebGLTexture tex = createTexture();
    fbuf = gl.createFramebuffer();
    gl.texImage2D(TEXTURE_2D, 0, RGBA, width, height, 0, RGBA, UNSIGNED_BYTE, null);
    WebGLRenderbuffer rbuf = gl.createRenderbuffer();
    gl.bindRenderbuffer(RENDERBUFFER, rbuf);
    gl.renderbufferStorage(RENDERBUFFER, RGBA4, width, height);
    gl.framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, TEXTURE_2D, tex, 0);
    gl.framebufferRenderbuffer(FRAMEBUFFER, DEPTH_ATTACHMENT, RENDERBUFFER, rbuf);
    gl.bindTexture(TEXTURE_2D, null);
    gl.bindRenderbuffer(RENDERBUFFER, null);
    gl.bindFramebuffer(FRAMEBUFFER, null);
    return fbuf;
}
Also used : WebGLTexture(com.google.gwt.webgl.client.WebGLTexture) WebGLRenderbuffer(com.google.gwt.webgl.client.WebGLRenderbuffer)

Example 2 with WebGLRenderbuffer

use of com.google.gwt.webgl.client.WebGLRenderbuffer in project libgdx by libgdx.

the class GwtGL20 method glGenRenderbuffers.

@Override
public void glGenRenderbuffers(int n, IntBuffer renderbuffers) {
    for (int i = 0; i < n; i++) {
        WebGLRenderbuffer rb = gl.createRenderbuffer();
        int id = this.renderBuffers.add(rb);
        renderbuffers.put(id);
    }
}
Also used : WebGLRenderbuffer(com.google.gwt.webgl.client.WebGLRenderbuffer)

Example 3 with WebGLRenderbuffer

use of com.google.gwt.webgl.client.WebGLRenderbuffer in project libgdx by libgdx.

the class GwtGL20 method glDeleteRenderbuffer.

@Override
public void glDeleteRenderbuffer(int id) {
    WebGLRenderbuffer rb = this.renderBuffers.remove(id);
    gl.deleteRenderbuffer(rb);
}
Also used : WebGLRenderbuffer(com.google.gwt.webgl.client.WebGLRenderbuffer)

Example 4 with WebGLRenderbuffer

use of com.google.gwt.webgl.client.WebGLRenderbuffer in project libgdx by libgdx.

the class GwtGL20 method glDeleteRenderbuffers.

@Override
public void glDeleteRenderbuffers(int n, IntBuffer renderbuffers) {
    for (int i = 0; i < n; i++) {
        int id = renderbuffers.get();
        WebGLRenderbuffer rb = this.renderBuffers.remove(id);
        gl.deleteRenderbuffer(rb);
    }
}
Also used : WebGLRenderbuffer(com.google.gwt.webgl.client.WebGLRenderbuffer)

Aggregations

WebGLRenderbuffer (com.google.gwt.webgl.client.WebGLRenderbuffer)4 WebGLTexture (com.google.gwt.webgl.client.WebGLTexture)1