Example #1
0
        private void GetAttributes()
        {
            int attributeCount = 0;

            RL.GetProgram(ProgramObject, ProgramParameter.ActiveAttributes, out attributeCount);

            if (Name.EndsWith("simpleFrame"))
            {
                //  No attributes in the frame shader
            }
            else if (Name.EndsWith("simplePrimitive"))
            {
                int pos = RL.GetAttribLocation(ProgramObject, "_position");
                int nor = RL.GetAttribLocation(ProgramObject, "_normal");
                Attributes.Add(new ProgramAttribute("_position", pos, 1, OpenTK.Graphics.OpenGL.ActiveAttribType.FloatVec3));
                Attributes.Add(new ProgramAttribute("_normal", nor, 1, OpenTK.Graphics.OpenGL.ActiveAttribType.FloatVec3));
            }
            else
            {
                Attributes.Clear();
                for (int i = 0; i < attributeCount; ++i)
                {
                    int size;
                    ActiveAttribType type;
                    string           name;

                    RL.GetActiveAttrib(ProgramObject, i, out size, out type, out name);

                    int slot = RL.GetAttribLocation(ProgramObject, name);

                    Trace.WriteLine("\tAttribute " + name + " slot " + slot.ToString());

                    var attribute = new ProgramAttribute(
                        name,
                        slot,
                        size,
                        (OpenTK.Graphics.OpenGL.ActiveAttribType)type
                        );

                    Attributes.Add(attribute);
                }
            }
        }
Example #2
0
        private void GetAttributes()
        {
            int attributeCount = 0;

            GL.GetProgram(
                ProgramObject,
                ProgramParameter.ActiveAttributes,
                out attributeCount
                );

            Attributes.Clear();
            for (int i = 0; i < attributeCount; ++i)
            {
                int size;
                ActiveAttribType type;

                string name = GL.GetActiveAttrib(
                    ProgramObject,
                    i,
                    out size,
                    out type
                    );

                int slot = GL.GetAttribLocation(ProgramObject, name);

                // Trace.WriteLine("\tAttribute " + name + " slot " + slot.ToString());

                var attribute = new ProgramAttribute(
                    name,
                    slot,
                    size,
                    type
                    );

                Attributes.Add(attribute);
            }
        }