Пример #1
0
        /// <summary>
        /// Set an element to this mapped BufferObject.
        /// </summary>
        /// <param name="value">
        /// A <see cref="Vertex2f"/> that specify the mapped BufferObject element.
        /// </param>
        /// <param name="offset">
        /// A <see cref="UInt64"/> that specify the offset applied to the mapped BufferObject where <paramref name="value"/>
        /// is stored. This value is expressed in basic machine units (bytes).
        /// </param>
        /// <exception cref="InvalidOperationException">
        /// Exception thrown if this BufferObject is not mapped (<see cref="IsMapped"/>).
        /// </exception>
        public void Set(Vertex2f value, UInt64 offset)
        {
            if (IsMapped == false)
            {
                throw new InvalidOperationException("not mapped");
            }

            unsafe
            {
                byte *    bufferPtr     = (byte *)MappedBuffer.ToPointer();
                Vertex2f *bufferItemPtr = (Vertex2f *)(bufferPtr + offset);

                bufferItemPtr[0] = value;
            }
        }
Пример #2
0
        private void DrawLines2f_GL_1_0(Vertex2f[] vertices)
        {
            if ((vertices.Length % 2) != 0)
            {
                throw new ArgumentException("length not a multiple of 2", "vertices");
            }

            Gl.Begin(PrimitiveType.Lines);
            for (int i = 0; i < vertices.Length; i += 2)
            {
                Vertex2f v1 = vertices[i], v2 = vertices[i + 1];

                Gl.Vertex2(v1.x, v1.y);
                Gl.Vertex2(v2.x, v2.y);
            }
            Gl.End();
        }
Пример #3
0
 /// <summary>
 /// Scale this ModelMatrix.
 /// </summary>
 /// <param name="s">
 /// A <see cref="Vertex2f"/> holding the scaling factors on two dimensions.
 /// </param>
 public void SetScale(Vertex2f s)
 {
     SetScale(s.x, s.y, 1.0f);
 }
Пример #4
0
 /// <summary>
 /// Construct a Matrix2x2f specifying the matrix columns.
 /// </summary>
 public Matrix2x2f(Vertex2f c0, Vertex2f c1)
 {
     Column0 = c0;
     Column1 = c1;
 }
Пример #5
0
 /// <summary>
 /// Construct a Matrix3x2f specifying the matrix columns.
 /// </summary>
 public Matrix3x2f(Vertex2f c0, Vertex2f c1, Vertex2f c2)
 {
     Column0 = c0;
     Column1 = c1;
     Column2 = c2;
 }
 /// <summary>
 /// Set uniform state variable (variant type variable).
 /// </summary>
 /// <param name="ctx">
 /// A <see cref="GraphicsContext"/> used for operations.
 /// </param>
 /// <param name="uniformName">
 /// A <see cref="String"/> that specify the variable name in the shader source.
 /// </param>
 /// <param name="v">
 /// A <see cref="Vertex2f"/> holding the uniform variabile data.
 /// </param>
 public void SetVariantUniform(GraphicsContext ctx, string uniformName, Vertex2f v)
 {
     SetVariantUniform(ctx, uniformName, v.x, v.y);
 }