Example usage for com.google.gwt.corp.webgl.client WebGL GL_COMPILE_STATUS

List of usage examples for com.google.gwt.corp.webgl.client WebGL GL_COMPILE_STATUS

Introduction

In this page you can find the example usage for com.google.gwt.corp.webgl.client WebGL GL_COMPILE_STATUS.

Prototype

int GL_COMPILE_STATUS

To view the source code for com.google.gwt.corp.webgl.client WebGL GL_COMPILE_STATUS.

Click Source Link

Usage

From source file:jake2.gwt.client.WebGLAdapter.java

License:Open Source License

private WebGL.Shader loadShader(int shaderType, String shaderSource) {
    // Create the shader object
    WebGL.Shader shader = gl.glCreateShader(shaderType);
    if (shader == null) {
        throw new RuntimeException();
    }//from ww  w  .ja  v  a 2  s .c om
    // Load the shader source
    gl.glShaderSource(shader, shaderSource);

    // Compile the shader
    gl.glCompileShader(shader);

    // Check the compile status
    boolean compiled = gl.glGetShaderParameterb(shader, WebGL.GL_COMPILE_STATUS);
    if (!compiled) {
        // Something went wrong during compilation; get the error
        throw new RuntimeException("Shader compile error: " + gl.glGetShaderInfoLog(shader));
    }
    return shader;
}