示例#1
0
            private void SetColorAttribute(GraphicsContext ctx)
            {
                if (ArrayBuffer != null)
                {
                    ArrayBufferObjectBase.IArraySection arraySection = ArrayBuffer.GetArraySection(ArraySectionIndex);

                    int arrayLength = (int)ArrayBufferItem.GetArrayLength(arraySection.ItemType);
                    int arrayStride = arraySection.Stride.ToInt32();

                    // Bind the array buffer
                    ArrayBuffer.Bind(ctx);

                    // Set vertex pointer
                    Gl.ColorPointer(
                        arrayLength, ArrayBufferItem.GetColorPointerType(arraySection.ItemType), arrayStride,
                        arraySection.Pointer
                        );
                    // Enable vertex attribute
                    Gl.EnableClientState(EnableCap.ColorArray);
                }
                else
                {
                    Gl.DisableClientState(EnableCap.ColorArray);
                }
            }