Exemplo 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;
 }
Exemplo n.º 2
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;
        }