internal void Clean()
        {
            _attributes.Clean();

            if (_dirtyIndexBuffer)
            {
                if (_indexBuffer != null)
                {
                    IndexBufferGL3x bufferObjectGL = (IndexBufferGL3x)_indexBuffer;
                    bufferObjectGL.Bind();
                }
                else
                {
                    IndexBufferGL3x.UnBind();
                }

                _dirtyIndexBuffer = false;
            }
        }
Beispiel #2
0
        public override void Draw(PrimitiveType primitiveType, DrawState drawState, SceneState sceneState)
        {
            VerifyDraw(drawState, sceneState);
            ApplyBeforeDraw(drawState, sceneState);

            VertexArrayGL3x vertexArray = (VertexArrayGL3x)drawState.VertexArray;
            IndexBufferGL3x indexBuffer = vertexArray.IndexBuffer as IndexBufferGL3x;

            if (indexBuffer != null)
            {
                GL.DrawRangeElements(TypeConverterGL3x.To(primitiveType),
                                     0, vertexArray.MaximumArrayIndex(), indexBuffer.Count,
                                     TypeConverterGL3x.To(indexBuffer.Datatype), new IntPtr());
            }
            else
            {
                GL.DrawArrays(TypeConverterGL3x.To(primitiveType), 0,
                              vertexArray.MaximumArrayIndex() + 1);
            }
        }