示例#1
0
 public object getUniform(WebGLProgram program, WebGLUniformLocation location)
 {
     return null;
 }
示例#2
0
 public void uniformMatrix4fv(WebGLUniformLocation location, bool transpose, float[] value)
 {
     return;
 }
示例#3
0
 public void uniformMatrix4fv(WebGLUniformLocation location, bool transpose, WebGLFloatArray value)
 {
     return;
 }
示例#4
0
 public void uniform4iv(WebGLUniformLocation location, int[] v)
 {
     return;
 }
示例#5
0
 public void uniform4iv(WebGLUniformLocation location, WebGLIntArray v)
 {
     return;
 }
示例#6
0
 public void uniform4fv(WebGLUniformLocation location, WebGLFloatArray v)
 {
     return;
 }
示例#7
0
 public void uniform4i(WebGLUniformLocation location, int x, int y, int z, int w)
 {
     return;
 }
示例#8
0
 public void uniform4f(WebGLUniformLocation location, float x, float y, float z, float w)
 {
     return;
 }
示例#9
0
 public void uniform4fv(WebGLUniformLocation location, float[] v)
 {
     return;
 }
示例#10
0
 public void uniform2f(WebGLUniformLocation location, float x, float y)
 {
     return;
 }
示例#11
0
 public void uniform2i(WebGLUniformLocation location, int x, int y)
 {
     return;
 }
示例#12
0
 public void uniform1i(WebGLUniformLocation location, int x)
 {
     return;
 }
示例#13
0
 public void uniform1f(WebGLUniformLocation location, float x)
 {
     return;
 }
示例#14
0
        public static void Init(RenderContext renderContext)
        {
            GL gl = renderContext.gl;

            String fragShaderText =
                    "    precision mediump float;                                                            \n" +
                    "    uniform vec4 lineColor;                                                             \n" +
                    "    varying lowp vec4 vColor;                                                           \n" +
                    "    uniform sampler2D uSampler;                                                         \n" +
                    "    void main(void)                                                                     \n" +
                    "    {                                                                                   \n" +
                    "        vec4 texColor;                                                                  \n" +
                    "        texColor = texture2D(uSampler, gl_PointCoord);                                  \n" +
                    "                                                                                        \n" +
                    "                                                                                        \n" +
                    "        gl_FragColor = lineColor * vColor * texColor;                                   \n" +
                    "    }                                                                                   \n";

            String vertexShaderText =
                    "    attribute vec3 aVertexPosition;                                                     \n" +
                    "    attribute vec4 aVertexColor;                                                        \n" +
                    "    attribute vec2 aTime;                                                               \n" +
                    "    attribute float aPointSize;                                                         \n" +
                    "    uniform mat4 uMVMatrix;                                                             \n" +
                    "    uniform mat4 uPMatrix;                                                              \n" +
                    "    uniform float jNow;                                                                 \n" +
                    "    uniform float decay;                                                                \n" +
                    "                                                                                        \n" +
                    "    varying lowp vec4 vColor;                                                           \n" +
                    "                                                                                        \n" +
                    "    void main(void)                                                                     \n" +
                    "    {                                                                                   \n" +
                    "        gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);                \n" +
                    "        float dAlpha = 1.0;                                                             \n" +
                    "        if ( decay > 0.0)                                                               \n" +
                    "        {                                                                               \n" +
                    "             dAlpha = 1.0 - ((jNow - aTime.y) / decay);                                 \n " +
                    "             if (dAlpha > 1.0 )                                                         \n" +
                    "             {                                                                          \n" +
                    "                  dAlpha = 1.0;                                                         \n" +
                    "             }                                                                          \n" +
                    "        }                                                                               \n" +
                    "     if (jNow < aTime.x && decay > 0.0)                                                 \n" +
                    "     {                                                                                  \n" +
                    "         vColor = vec4(0.0, 0.0, 0.0, 0.0);                                             \n" +
                    "     }                                                                                  \n" +
                    "     else                                                                               \n" +
                    "     {                                                                                  \n" +
                    "        vColor = vec4(aVertexColor.r, aVertexColor.g, aVertexColor.b, dAlpha);          \n" +
                    "     }                                                                                  \n" +
                    "        gl_PointSize = aPointSize/0.1;                                                  \n" +
                    "    }                                                                                   \n" +
                    "                                                                                        \n";

            frag = gl.createShader(GL.FRAGMENT_SHADER);
            gl.shaderSource(frag, fragShaderText);
            gl.compileShader(frag);

            object stat = gl.getShaderParameter(frag, GL.COMPILE_STATUS);

            vert = gl.createShader(GL.VERTEX_SHADER);
            gl.shaderSource(vert, vertexShaderText);
            gl.compileShader(vert);
            object stat1 = gl.getShaderParameter(vert, GL.COMPILE_STATUS);
            object compilationLog = gl.getShaderInfoLog(vert);
            prog = gl.createProgram();

            gl.attachShader(prog, vert);
            gl.attachShader(prog, frag);
            gl.linkProgram(prog);
            object errcode = gl.getProgramParameter(prog, GL.LINK_STATUS);

            gl.useProgram(prog);

            vertLoc = gl.getAttribLocation(prog, "aVertexPosition");
            colorLoc = gl.getAttribLocation(prog, "aVertexColor");
            pointSizeLoc = gl.getAttribLocation(prog, "aPointSize");
            timeLoc = gl.getAttribLocation(prog, "aTime");
            projMatLoc = gl.getUniformLocation(prog, "uPMatrix");
            mvMatLoc = gl.getUniformLocation(prog, "uMVMatrix");
            sampLoc = gl.getUniformLocation(prog, "uSampler");
            jNowLoc = gl.getUniformLocation(prog, "jNow");
            decayLoc = gl.getUniformLocation(prog, "decay");
            lineColorLoc = gl.getUniformLocation(prog, "lineColor");

            gl.enable(GL.BLEND);

            initialized = true;
        }
示例#15
0
        public static void Init(RenderContext renderContext)
        {
            GL gl = renderContext.gl;

            String fragShaderText =
                      " precision mediump float;                                                              \n" +
                      "                                                                                       \n" +
                      "   varying vec2 vTextureCoord;                                                         \n" +
                      "                                                                                       \n" +
                      "   uniform sampler2D uSampler;                                                         \n" +
                      "                                                                                       \n" +
                      "   void main(void) {                                                                   \n" +
                      "   gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));         \n" +
                      "   }                                                                                   \n";

            String vertexShaderText =
                    "     attribute vec3 aVertexPosition;                                              \n" +
                    "     attribute vec2 aTextureCoord;                                                \n" +
                    "                                                                                  \n" +
                    "     uniform mat4 uMVMatrix;                                                      \n" +
                    "     uniform mat4 uPMatrix;                                                       \n" +
                    "                                                                                  \n" +
                    "     varying vec2 vTextureCoord;                                                  \n" +
                    "                                                                                  \n" +
                    "                                                                                  \n" +
                    "     void main(void) {                                                            \n" +
                    "         gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);         \n" +
                    "         vTextureCoord = aTextureCoord;                                           \n" +
                    "     }                                                                            \n" +
                    "                                                                                  \n";
            frag = gl.createShader(GL.FRAGMENT_SHADER);
            gl.shaderSource(frag, fragShaderText);
            gl.compileShader(frag);

            object stat = gl.getShaderParameter(frag, GL.COMPILE_STATUS);

            vert = gl.createShader(GL.VERTEX_SHADER);
            gl.shaderSource(vert, vertexShaderText);
            gl.compileShader(vert);
            object stat1 = gl.getShaderParameter(vert, GL.COMPILE_STATUS);

            prog = gl.createProgram();

            gl.attachShader(prog, vert);
            gl.attachShader(prog, frag);
            gl.linkProgram(prog);
            object errcode = gl.getProgramParameter(prog, GL.LINK_STATUS);

            gl.useProgram(prog);

            vertLoc = gl.getAttribLocation(prog, "aVertexPosition");
            textureLoc = gl.getAttribLocation(prog, "aTextureCoord");
            projMatLoc = gl.getUniformLocation(prog, "uPMatrix");
            mvMatLoc = gl.getUniformLocation(prog, "uMVMatrix");
            sampLoc = gl.getUniformLocation(prog, "uSampler");

            Tile.uvMultiple = 1;
            Tile.DemEnabled = true;

            gl.enable(GL.BLEND);
            gl.blendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA);
            initialized = true;
        }
示例#16
0
        public static void Init(RenderContext renderContext)
        {
            GL gl = renderContext.gl;

            String fragShaderText =
                      " precision highp float;                                                              \n" +
                      " uniform vec4 lineColor;                                                               \n" +
                      "                                                                                       \n" +
                      "   void main(void) {                                                                   \n" +
                      "   gl_FragColor = lineColor;         \n" +
                      "   }                                                                                   \n";

            String vertexShaderText =
                    "     attribute vec3 aVertexPosition;                                              \n" +
                    "                                                                                  \n" +
                    "     uniform mat4 uMVMatrix;                                                      \n" +
                    "     uniform mat4 uPMatrix;                                                       \n" +
                    "                                                                                  \n" +
                    "                                                                                  \n" +
                    "                                                                                  \n" +
                    "     void main(void) {                                                            \n" +
                    "         gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);         \n" +
                    "     }                                                                            \n" +
                    "                                                                                  \n";
            frag = gl.createShader(GL.FRAGMENT_SHADER);
            gl.shaderSource(frag, fragShaderText);
            gl.compileShader(frag);

            object stat = gl.getShaderParameter(frag, GL.COMPILE_STATUS);

            vert = gl.createShader(GL.VERTEX_SHADER);
            gl.shaderSource(vert, vertexShaderText);
            gl.compileShader(vert);
            object stat1 = gl.getShaderParameter(vert, GL.COMPILE_STATUS);

            prog = gl.createProgram();

            gl.attachShader(prog, vert);
            gl.attachShader(prog, frag);
            gl.linkProgram(prog);
            object errcode = gl.getProgramParameter(prog, GL.LINK_STATUS);

            gl.useProgram(prog);

            vertLoc = gl.getAttribLocation(prog, "aVertexPosition");
            lineColorLoc = gl.getUniformLocation(prog, "lineColor");
            projMatLoc = gl.getUniformLocation(prog, "uPMatrix");
            mvMatLoc = gl.getUniformLocation(prog, "uMVMatrix");

            gl.enable(GL.BLEND);
            gl.blendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA);
            initialized = true;
        }