0

I want to draw a Wireframe of an 3d object, using OpenTK, but i don't want to draw it by opentk method, but by my own I guess i have to do it by drawing on opentk buffor, but don't know how to start. I mean, i have a method to draw, but how to override the drawing from OpenTK?

// Push current Array Buffer state so we can restore it later
        GL.PushClientAttrib(ClientAttribMask.ClientVertexArrayBit);
        GL.Color3(Color.SkyBlue);
        //GL.ClientActiveTexture(TextureUnit.Texture0);
        //GL.BindTexture(TextureTarget.Texture2D, tex);

        GL.BindBuffer(BufferTarget.ArrayBuffer, dataBuffer);
        // Normal buffer
        GL.NormalPointer(NormalPointerType.Float, 0, (IntPtr)(normOffset * sizeof(float)));

        // TexCoord buffer
        GL.TexCoordPointer(2, TexCoordPointerType.Float, 0, (IntPtr)(texcoordOffset * sizeof(float)));

        // Vertex buffer
        GL.VertexPointer(3, VertexPointerType.Float, 0, (IntPtr)(vertOffset * sizeof(float)));

        // Index array
        GL.BindBuffer(BufferTarget.ElementArrayBuffer, indexBuffer);
        GL.DrawElements(BeginMode.Triangles, mesh.Tris.Length * 3, DrawElementsType.UnsignedInt, IntPtr.Zero);
       // GL.DrawElements(BeginMode.Lines, mesh.Tris.Length * 3, DrawElementsType.UnsignedByte, IntPtr.Zero);
        // Restore the state
        GL.PopClientAttrib();
Hamid Pourjam
  • 20,441
  • 9
  • 58
  • 74
johns
  • 183
  • 1
  • 14
  • don't know what you mean.. – johns Jan 11 '14 at 22:15
  • Did you mean to say buffer instead of buffor? Also have your read through [OpenTK VBO](http://www.opentk.com/doc/graphics/geometry/vertex-buffer-objects) and related documentation? – John Alexiou Jan 11 '14 at 23:07
  • The OpenTK Draw method is essential for rendering, you cannot just stream on your own to your graphics card without an absurd amount of overhead, why do you want to override the OpenTK draw methods? – Vengarioth Jan 12 '14 at 13:21
  • as my asigment for classes i need to draw wireframe using my own method of drawing... that's why i want to replace the OpenTK's method – johns Jan 12 '14 at 13:55
  • I doubt your assignment is to write a rendering pipeline, maybe you should clarify what you should write yourself. a good rasterizer alone would take weeks to write :) – Vengarioth Jan 12 '14 at 21:33

0 Answers0