OpenTK, GTK#, GLControl, and GLWidget

Sigh… So I’m banging my head against the wall trying to get a GLControl working in a GTK# project in MonoDevelop… Not gonna work.

The GLControl inherits from System.Windows.Forms.UserControl, so you basically end up resorting to exactly what you wanted to avoid in the first place by using GTK#, i.e. Windows Forms. Here’s an image of the error (click to enlarge):

OpenTK GLControl error

Instead, you need to use a GLWidget with GTK#.

http://www.opentk.com/project/glwidget

Anyways, hopefully that will help someone from having a bloody forehead.

I’d been trying to add a reference to OpenTK.GLControl.dll and trying to get it to work in the visual designer (stetic) with no luck. I searched around for answers, and didn’t get any. I then simply tried to add it manually. And that was it. The error.

People have complained about OpenTK not really having the best documentation, but I’m going to stick with it for a while longer and hope that I can fudge my way through it enough to finally get to that stage where I can be productive. It seems like with things like this, the ramp up time and effort that it takes to get started is the most painful part. From past experience, I’m expecting things to finally smooth out in the very near future.

So, on to OpenTK with GTK# and MonoDevelop!

Cheers,

Ryan

Share

Written by:

279 Posts

View All Posts
Follow Me :

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 thoughts on “OpenTK, GTK#, GLControl, and GLWidget

  1. I am in the same boat, although using VS2010 — got a full-screen app running great using GameWindow, but when I want to integrate it to an existing C# app as a second window I poured over the GLControl tutorials, etc. to no avail. Tried adding it to the Toolbox, but couldn’t add it to my form. Tried new-ing one up, but it never shows. Tried “UserControl with CodeBehind” techniques, etc. I have a bloody forehead. I will try your link with crossed fingers!