Tutorial :opengl in C# using Tao.OpenGL


I am working on an OpenGL project for a computer graphics course, and I have not been actively programming for around a years time (military training). I am drawing an absolute blank on how to include a source file in C#. I know in C++ you use #include . I have no clue how to use the figure class I made in my form.


Also look at http://www.opentk.com as it is better suited for C#. For example it uses native enums for the OpenGL constants. I usually add a reference

using gl = OpenTK.Graphics.OpenGL.GL;  using vec3 = OpenTK.Vector3d;  using col = System.Drawing.Color;  

and then in my code I just type

        ...          vec3 pos = new vec3(10f,0f,0f);          gl.Disable(EnableCap.Lighting);          gl.LineWidth(2f);          gl.Color3(col.DimGray);          gl.Begin(BeginMode.Lines);          gl.Vertex3(0.0, 0.0, 0.0);          gl.Vertex3(pos);          gl.End();          gl.Enable(EnableCap.Lighting);          ...  


  1. Add the Tao.OpenGL DLL as a project reference.
  2. Add any using statements at the top of your C# file, such as:

    using Tao.OpenGL;

The first option is what actually "includes" the DLL so it can be found. The second step is technically optionally, but without it, you'll need to make every GL call like Tao.OpenGL.GL.GlMethodGoesHere(); instead of just GL.GlMethodGoesHere();


haha, I meant including my own class that I made, but I figured it out. Had to use "using myClass," not the file name.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »