tags:

views:

5366

answers:

7
+7  Q: 

C# OpenGL

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

+1  A: 

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.

korona
In what namespace can these classes be found?
MegaByte
+1  A: 

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/

Nailer
Im very new to this technology. Im not familiar with the XNA framework :(
MegaByte
If you're going to make games in C# XNA should be your pick. If you want to learn the inner workings of graphics programming, you might want to start elsewhere.
Nailer
+3  A: 

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.
Ólafur Waage
+3  A: 

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/

Oliver
+1  A: 

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.

Chris Masterton
+1  A: 

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.

Jeff Mc
+9  A: 

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...