Hello
I am working on a recent project and I have been learning how to code in C# using OpenGL libraries for some graphics. I have achieved some quite interesting things using TAO Framework writing in Console Applications, creating a GLUT Window. But my problem now is that I need to incorporate the Graphics in a Windows Form so I can relate the objects that I render with some .NET Controls.
To deal with this problem, I have seen in some forums that it's better to use OpenTK instead of TAO Framework, so I can use the glControl that OpenTK libraries offer. However, I haven't found complete articles, tutorials or source codes that help using the glControl or that may insert me into de OpenTK functions. Would somebody please share in this forum some links or files where I can find good documentation about this topic? Or may I use another library different of OpenTK?
Thanks!
C# Windows Forms and OpenTK (glControl)
Seems you did not search enougth. I found THIS in the top 3 results from googel and it seems to be very very beginners friendly.
Ohterwise the native way round for GL in C# uses a window handle to generate the render target from. A Winforms control class has a property to grab its HWND Window Handle so you could pass that as IntPtr (or on the other side as void*) into some GL setup code. I did this a lot of times and it works regardless of the control you use.
To orevent flickering on frequent updates you need just to override some painting settings in your window
this.SetStyle(
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer,
true);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement