Hi everyone...
Is there free OpenGL support libraries for C#? If so, which one do I use and where do I find sample projects ?
EDIT #1
Does C# provide classes for OpenGL ?
Thanks
Hi everyone...
Is there free OpenGL support libraries for C#? If so, which one do I use and where do I find sample projects ?
EDIT #1
Does C# provide classes for OpenGL ?
Thanks
What would you like these support libraries to do? Just using OpenGL from C# is simple enough and does not require any additional libraries afaik.
When you're first tying down your platform to windows by choosing C# is there a reason for you not to use the XNA framework for graphics programming? Just curious.
Edit: A quick google search found me this tutorial on how to use Open GL in C# via the TAO framework:
http://xinyustudio.wordpress.com/2008/12/01/using-opengl-in-c-taoframework/
Tao is supposed to be a nice framework.
From their site:
The Tao Framework for .NET is a collection of bindings to facilitate
cross-platform media application development utilizing
the .NET and Mono platforms.
So Olafur was faster. sighh
I would also recommend the Tao Framework. But one additional note:
Take a look at these tutorials: http://www.taumuon.co.uk/jabuka/
XNA 2.0 requires a minimum of a shader 1.1 card. While old tech, not everyone has one. Some newer laptops (in our experience Toshiba tablets with Intel graphics) have no shader 1.1 support. XNA simply wont run on these machines.
This is a significant issue for us and we have shifted to Tao and OpenGL. Plus with Tao we have bindings for audio & Lua support.
I think what @korona meant was since it's just a C API, you can consume it from C# directly with a heck of a lot of typing like this:
[DllImport("opengl32")]
public static extern void glVertex3f(float x, float y, float z);
You unfortunately would need to do this for every single OpenGL function you call, and is basically what Tao has done for you.
OpenTK is an improvement over the Tao API, as it uses idiomatic C# style with overloading, strongly-typed enums, exceptions, and standard .NET types:
GL.Begin(BeginMode.Points);
GL.Color3(Color.Yellow);
GL.Vertex3(Vector3.Up);
as opposed to Tao which merely mirrors the C API:
Gl.glBegin(Gl.GL_POINTS); // double "gl" prefix
Gl.glColor3ub(255, 255, 0); // have to pass RGB values as separate args
Gl.glVertex3f(0, 1, 0); // explicit "f" qualifier
This makes for harder porting but is incredibly nice to use.
As a bonus it provides font rendering, texture loading, input handling, audio, math...