Ejemplo n.º 1
0
        public string getShaderInfoLog(Web.WebGLShader shader)
        {
#if _DEBUG
            Log.Info("getShaderInfoLog");
#endif

            var GL_INFO_LOG_LENGTH = 35716;
            //var GL_SHADING_LANGUAGE_VERSION = 35724;
            int k;
            unsafe
            {
                Gl.glGetShaderiv(shader.Value, GL_INFO_LOG_LENGTH, &k);
            }
            if (k <= 0)
            {
                return(string.Empty);
            }

            var result = new byte[k];
            unsafe
            {
                fixed(byte *presult = result)
                {
                    Gl.glGetShaderInfoLog(shader.Value, k, &k, presult);
                }
            }

            ////var version = glGetString(GL_SHADING_LANGUAGE_VERSION);

            return(new string(Encoding.ASCII.GetChars(result)));
        }
Ejemplo n.º 2
0
        public void shaderSource(Web.WebGLShader shader, string source)
        {
#if _DEBUG
            Log.Info(string.Format("shaderSource {0}, source length {1}", shader.Value, source.Length));
#endif

            var bytes = Encoding.ASCII.GetBytes(source);
            var len   = bytes.Length;

            unsafe
            {
                fixed(byte *b = bytes)
                {
                    byte *[] barray = new byte *[] { b };
                    fixed(byte **pb = barray)
                    {
                        Gl.glShaderSource(shader.Value, 1, pb, &len);
                    }
                }
            }

#if _DEBUG
            ErrorTest();
#endif
        }
Ejemplo n.º 3
0
        public void attachShader(Web.WebGLProgram program, Web.WebGLShader shader)
        {
#if _DEBUG
            Log.Info(string.Format("attachShader {0} {1}", program.Value, shader.Value));
#endif
            Gl.glAttachShader(program.Value, shader.Value);
#if _DEBUG
            ErrorTest();
#endif
        }
Ejemplo n.º 4
0
        public void deleteShader(Web.WebGLShader shader)
        {
#if _DEBUG
            Log.Info(string.Format("deleteShader", shader.Value));
#endif

            Gl.glDeleteShader(shader.Value);
#if _DEBUG
            ErrorTest();
#endif
        }
Ejemplo n.º 5
0
        public void compileShader(Web.WebGLShader shader)
        {
#if _DEBUG
            Log.Info(string.Format("compileShader {0}", shader.Value));
#endif

            Gl.glCompileShader(shader.Value);
#if _DEBUG
            ErrorTest();
#endif
        }
Ejemplo n.º 6
0
        public object getShaderParameter(Web.WebGLShader shader, int pname)
        {
#if _DEBUG
            Log.Info(string.Format("getShaderParameter {0} {1}", shader.Value, pname));
#endif

            int i;
            unsafe
            {
                Gl.glGetShaderiv(shader.Value, pname, &i);
            }

#if _DEBUG
            ErrorTest();
#endif

#if _DEBUG
            Log.Info(string.Format("value {0}", i));
#endif

            return(i);
        }
Ejemplo n.º 7
0
 public bool isShader(Web.WebGLShader shader)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 8
0
 public void detachShader(Web.WebGLProgram program, Web.WebGLShader shader)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 9
0
 public string getShaderSource(Web.WebGLShader shader)
 {
     throw new NotImplementedException();
 }