Esempio n. 1
0
 internal GLProgram(bool valid, int programHandle, GLVertexSignature signature, GLUniformBlock[] uniformBlocks, GLUniform[] uniforms, string infoLog = null)
 {
     Valid = valid;
     Handle = programHandle;
     Signature = signature;
     UniformBlocks = uniformBlocks;
     Uniforms = uniforms;
     InfoLog = infoLog;
 }
Esempio n. 2
0
        private static GLUniform[] ExtractUniforms(int programHandle)
        {
            int uniformCount;
            GL.GetProgram(programHandle, GetProgramParameterName.ActiveUniforms, out uniformCount);

            GLUniform[] uniforms = new GLUniform[uniformCount];

            for (int i = 0; i < uniformCount; ++i)
            {
                int count;
                ActiveUniformType type;
                string name = GL.GetActiveUniform(programHandle, i, out count, out type);
                int location = GL.GetUniformLocation(programHandle, name);

                int componentCount, componentSize;
                MeasureActiveUniform(type, out componentCount, out componentSize);

                uniforms[i] = new GLUniform(type, i, location, count, name, componentCount, componentSize);
            }

            return uniforms;
        }
Esempio n. 3
0
        private static GLUniformBlock[] ExtractUniformBlocks(int programHandle, GLUniform[] uniforms)
        {
            int uniformBlockCount;
            GL.GetProgram(programHandle, GetProgramParameterName.ActiveUniformBlocks, out uniformBlockCount);

            GLUniformBlock[] uniformBlocks = new GLUniformBlock[uniformBlockCount];

            for (int i = 0; i < uniformBlockCount; i++)
            {
                int nameLength;
                StringBuilder sb = new StringBuilder();
                GL.GetActiveUniformBlockName(programHandle, i, 100, out nameLength, sb);
                string uniformBlockName = sb.ToString();

                int activeUniforms;
                GL.GetActiveUniformBlock(programHandle, i, ActiveUniformBlockParameter.UniformBlockActiveUniforms, out activeUniforms);
                int[] activeUniformIndices = new int[activeUniforms];
                GL.GetActiveUniformBlock(programHandle, i, ActiveUniformBlockParameter.UniformBlockActiveUniformIndices, activeUniformIndices);
                int dataSize;
                GL.GetActiveUniformBlock(programHandle, i, ActiveUniformBlockParameter.UniformBlockDataSize, out dataSize);

                uniformBlocks[i] = new GLUniformBlock(i, uniformBlockName);
            }

            return uniformBlocks;
        }