Example #1
0
 public uint CreateShader(OpenGL gl, string source, uint mode)
 {
     uint shaderId = gl.CreateShader(mode);
     gl.ShaderSource(shaderId, source);
     gl.CompileShader(shaderId);
     StringBuilder glError = new StringBuilder();
     gl.GetShaderInfoLog(shaderId, 1000, new IntPtr(), glError);
     return shaderId;
 }
Example #2
-1
        public static Option<string> GetShaderInfoLog(OpenGL gl, uint shaderHandle)
        {
            int[] status = new int[1];
            gl.GetShader(shaderHandle, OpenGL.GL_COMPILE_STATUS, status);
            if (status[0] == OpenGL.GL_FALSE)
            {
            int[] logLength = new int[1];
            gl.GetShader(shaderHandle, OpenGL.GL_INFO_LOG_LENGTH, logLength);

            StringBuilder log = new StringBuilder(logLength[0]);
            gl.GetShaderInfoLog(shaderHandle, logLength[0], IntPtr.Zero, log);
            return Option<string>.Some(log.ToString());
            } else
            {
            return Option<string>.None();
            }
        }
        public string GetShaderInfoLog(OpenGL gl, ShaderTypes type)
        {
            //  Get the info log length.
            int[] infoLength = GetShaderResult(gl, type, GetShaderActions.GL_INFO_LOG_LENGTH, 1);
            int bufSize = infoLength[0];

            //  Get the compile info.
            StringBuilder il = new StringBuilder(bufSize);
            gl.GetShaderInfoLog(ShaderIds[type], bufSize, IntPtr.Zero, il);

            return il.ToString();
        }