Search in sources :

Example 1 with WebGLTexture

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

the class WebGLDemo method createTexture.

private WebGLTexture createTexture() {
    WebGLTexture tex = gl.createTexture();
    gl.bindTexture(TEXTURE_2D, tex);
    gl.texParameteri(TEXTURE_2D, TEXTURE_MAG_FILTER, LINEAR);
    gl.texParameteri(TEXTURE_2D, TEXTURE_MIN_FILTER, LINEAR);
    gl.texParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE);
    gl.texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
    return tex;
}
Also used : WebGLTexture(com.google.gwt.webgl.client.WebGLTexture)

Example 2 with WebGLTexture

use of com.google.gwt.webgl.client.WebGLTexture 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 3 with WebGLTexture

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

the class GwtGL20 method glGenTextures.

@Override
public void glGenTextures(int n, IntBuffer textures) {
    for (int i = 0; i < n; i++) {
        WebGLTexture texture = gl.createTexture();
        int id = this.textures.add(texture);
        textures.put(id);
    }
}
Also used : WebGLTexture(com.google.gwt.webgl.client.WebGLTexture)

Example 4 with WebGLTexture

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

the class GwtGL20 method glDeleteTexture.

@Override
public void glDeleteTexture(int id) {
    WebGLTexture texture = this.textures.remove(id);
    gl.deleteTexture(texture);
}
Also used : WebGLTexture(com.google.gwt.webgl.client.WebGLTexture)

Example 5 with WebGLTexture

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

the class GwtGL20 method glDeleteTextures.

@Override
public void glDeleteTextures(int n, IntBuffer textures) {
    for (int i = 0; i < n; i++) {
        int id = textures.get();
        WebGLTexture texture = this.textures.remove(id);
        gl.deleteTexture(texture);
    }
}
Also used : WebGLTexture(com.google.gwt.webgl.client.WebGLTexture)

Aggregations

WebGLTexture (com.google.gwt.webgl.client.WebGLTexture)6 ImageElement (com.google.gwt.dom.client.ImageElement)1 NativeEvent (com.google.gwt.dom.client.NativeEvent)1 WebGLRenderbuffer (com.google.gwt.webgl.client.WebGLRenderbuffer)1