Esempio n. 1
0
 public bool isShader(WebGLShader shader)
 {
     return false; ;
 }
Esempio n. 2
0
 public void shaderSource(WebGLShader shader, string source)
 {
     return;
 }
Esempio n. 3
0
 public object getShaderParameter(WebGLShader shader, int pname)
 {
     return null;
 }
Esempio n. 4
0
 public String getShaderSource(WebGLShader shader)
 {
     return null;
 }
Esempio n. 5
0
 public void detachShader(WebGLProgram program, WebGLShader shader)
 {
     return;
 }
Esempio n. 6
0
 public String getShaderInfoLog(WebGLShader shader)
 {
     return null;
 }
Esempio n. 7
0
 public void deleteShader(WebGLShader shader)
 {
     return;
 }
Esempio n. 8
0
 public void compileShader(WebGLShader shader)
 {
     return;
 }
Esempio n. 9
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;
        }
Esempio n. 10
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;
        }
Esempio n. 11
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;
        }