Example usage for com.google.gwt.webgl.client WebGLUtil createShaderProgram

List of usage examples for com.google.gwt.webgl.client WebGLUtil createShaderProgram

Introduction

In this page you can find the example usage for com.google.gwt.webgl.client WebGLUtil createShaderProgram.

Prototype

public static WebGLProgram createShaderProgram(WebGLRenderingContext gl, String vertexSource,
            String fragmentSource) 

Source Link

Usage

From source file:playn.html.HtmlGLShader.java

License:Apache License

protected HtmlGLShader(HtmlGLContext ctx, String fragmentShader) {
    this.ctx = ctx;
    this.gl = ctx.gl;

    // Compile the shader.
    program = WebGLUtil.createShaderProgram(gl, VERTEX_SHADER, fragmentShader);

    // glGet*() calls are slow; determine locations once.
    uScreenSizeLoc = gl.getUniformLocation(program, "u_ScreenSize");
    aMatrix = gl.getAttribLocation(program, "a_Matrix");
    aTranslation = gl.getAttribLocation(program, "a_Translation");
    aPosition = gl.getAttribLocation(program, "a_Position");
    aTexture = gl.getAttribLocation(program, "a_Texture");

    // Create the vertex and index buffers.
    vertexBuffer = gl.createBuffer();//  ww  w .ja  v  a2s .  c o  m
    elementBuffer = gl.createBuffer();
}