public void Draw(TextHandle handle)
        {
            VboTextHandle vbo = (VboTextHandle)handle;

            //GL.PushClientAttrib(ClientAttribMask.ClientVertexArrayBit);

            //GL.EnableClientState(EnableCap.TextureCoordArray);
            GL.EnableClientState(EnableCap.VertexArray);

            GL.BindBuffer(BufferTarget.ArrayBuffer, vbo.vbo_id);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, vbo.ebo_id);

            GL.TexCoordPointer(2, TexCoordPointerType.Float, vector2_size, (IntPtr)vector2_size);
            GL.VertexPointer(2, VertexPointerType.Float, vector2_size, IntPtr.Zero);

            GL.DrawElements(BeginMode.Triangles, vbo.element_count, DrawElementsType.UnsignedShort, IntPtr.Zero);
            //GL.DrawArrays(BeginMode.LineLoop, 0, vbo.element_count);

            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0);

            GL.DisableClientState(EnableCap.VertexArray);
            //GL.DisableClientState(EnableCap.TextureCoordArray);

            //GL.PopClientAttrib();
        }
Esempio n. 2
0
 /// <summary>
 /// Prepares text for drawing.
 /// </summary>
 /// <param name="text">The string to draw.</param>
 /// <param name="font">The font to use for drawing.</param>
 /// <param name="handle">The handle to the cached text. Use this to draw the text with the Draw() function.</param>
 /// <param name="width">Not implemented.</param>
 /// <param name="wordWarp">Not implemented.</param>
 /// <see cref="TextPrinter.Draw()"/>
 public void Prepare(string text, TextureFont font, out TextHandle handle, float width, bool wordWarp)
 {
     this.Prepare(text, font, out handle, width, wordWarp, StringAlignment.Near, false);
 }
Esempio n. 3
0
 /// <summary>
 /// Draws the cached text referred to by the TextHandle.
 /// </summary>
 /// <param name="handle">The TextHandle to the cached text.</param>
 public void Draw(TextHandle handle)
 {
     GL.BindTexture(TextureTarget.Texture2d, handle.font.Texture);
     
     printer.Draw(handle);
 }
Esempio n. 4
0
        /// <summary>
        /// Prepares text for drawing.
        /// </summary>
        /// <param name="text">The string to draw.</param>
        /// <param name="font">The font to use for drawing.</param>
        /// <param name="handle">The handle to the cached text. Use this to draw the text with the Draw() function.</param>
        /// <param name="width">Not implemented.</param>
        /// <param name="wordWarp">Not implemented.</param>
        /// <param name="alignment">Not implemented.</param>
        /// <param name="rightToLeft">Not implemented.</param>
        /// <see cref="TextPrinter.Draw()"/>
        /// <exception cref="NotSupportedException">Occurs when OpenGL 1.1 is not supported.</exception>
        public void Prepare(string text, TextureFont font, out TextHandle handle, float width, bool wordWarp, StringAlignment alignment, bool rightToLeft)
        {
            if (!functionality_checked)
                CheckNeededFunctionality();

            int num_indices;

            PerformLayout(text, font, width, wordWarp, alignment, rightToLeft, ref vertices, ref indices, out num_indices);

            handle = printer.Load(vertices, indices, num_indices);
            handle.font = font;
        }
 public void Draw(TextHandle handle)
 {
     GL.CallList(handle.Handle);
 }
Esempio n. 6
-1
 /// <summary>
 /// Prepares text for drawing.
 /// </summary>
 /// <param name="text">The string to draw.</param>
 /// <param name="font">The font to use for drawing.</param>
 /// <param name="handle">The handle to the cached text. Use this to draw the text with the Draw() function.</param>
 /// <see cref="TextPrinter.Draw()"/>
 public void Prepare(string text, TextureFont font, out TextHandle handle)
 {
     this.Prepare(text, font, out handle, 0, false, StringAlignment.Near, false);
 }