Ejemplo n.º 1
0
            /// <summary>
            /// Allocate an instance of the type.
            /// </summary>
            /// <param name="ctx">
            /// A <see cref="GraphicsContext"/> used for allocating the instance.
            /// </param>
            /// <returns>
            /// It returns an instance of a specific type.
            /// </returns>
            public override object Allocate(GraphicsContext ctx)
            {
                VertexArrayBatchObject vertexArrayObject = new VertexArrayBatchObject();
                ArrayBufferObject      arrayBufferObject;

                arrayBufferObject = new ArrayBufferObject(VertexBaseType.Float, 3, BufferObjectHint.StaticCpuDraw);
                arrayBufferObject.Create(16);
                vertexArrayObject.SetArray(arrayBufferObject, VertexArraySemantic.Position);

                arrayBufferObject = new ArrayBufferObject(VertexBaseType.Float, 2, BufferObjectHint.StaticCpuDraw);
                arrayBufferObject.Create(16);
                vertexArrayObject.SetArray(arrayBufferObject, VertexArraySemantic.TexCoord);

                vertexArrayObject.SetElementArray(PrimitiveType.Lines);

                return(vertexArrayObject);
            }
Ejemplo n.º 2
0
            /// <summary>
            /// Allocate an instance of the type mocked for spying.
            /// </summary>
            /// <param name="ctx">
            /// A <see cref="GraphicsContext"/> used for allocating the instance.
            /// </param>
            /// <returns>
            /// It returns an instance of a specific type.
            /// </returns>
            public override T AllocateSpy <T>(GraphicsContext ctx)
            {
                T arrayBufferObjectSpy = (T)CreateTypeSpy(_InstanceType);
                VertexArrayBatchObject vertexArrayObject = arrayBufferObjectSpy as VertexArrayBatchObject;

                if (vertexArrayObject != null)
                {
                    ArrayBufferObject arrayBufferObject;

                    arrayBufferObject = new ArrayBufferObject(VertexBaseType.Float, 3, BufferObjectHint.StaticCpuDraw);
                    arrayBufferObject.Create(16);
                    vertexArrayObject.SetArray(arrayBufferObject, VertexArraySemantic.Position);

                    arrayBufferObject = new ArrayBufferObject(VertexBaseType.Float, 2, BufferObjectHint.StaticCpuDraw);
                    arrayBufferObject.Create(16);
                    vertexArrayObject.SetArray(arrayBufferObject, VertexArraySemantic.TexCoord);

                    vertexArrayObject.SetElementArray(PrimitiveType.Lines);
                }

                return(arrayBufferObjectSpy);
            }