//
        // Methods
        //

#if OPENGL
        internal VertexBuffer3D(Context3D context3D, int numVertices, int dataPerVertex, int multiBufferCount, bool isDynamic)
        {
            if (multiBufferCount < 1)
            {
                throw new ArgumentOutOfRangeException("multiBufferCount");
            }

            mContext     = context3D;
            mNumVertices = numVertices;
            mVertexSize  = dataPerVertex;
            mIds         = new uint[multiBufferCount];
            GL.GenBuffers(mIds.Length, mIds);

            mUsage = isDynamic ? BufferUsage.DynamicDraw : BufferUsage.StaticDraw;

            // update stats
            mContext.statsIncrement(Context3D.Stats.Count_VertexBuffer);
        }
Beispiel #2
0
        //
        // Methods
        //

#if OPENGL
        internal IndexBuffer3D(Context3D context3D, int numIndices, int multiBufferCount, bool isDynamic)
        {
            if (multiBufferCount < 1)
            {
                throw new ArgumentOutOfRangeException("multiBufferCount");
            }

            mContext     = context3D;
            mNumIndices  = numIndices;
            mIds         = new uint[multiBufferCount];
            mElementType = DrawElementsType.UnsignedShort;
            GL.GenBuffers(multiBufferCount, mIds);
            GLUtils.CheckGLError();

            mUsage = isDynamic ? BufferUsage.DynamicDraw : BufferUsage.StaticDraw;

            // update stats
            mContext.statsIncrement(Context3D.Stats.Count_IndexBuffer);
        }