Ysbryd's picture

Windows Forms C# and Antialiasing

Hi,

I am trying to include a GLcontrol into a windows form application and have so far managed to do it. My problem is that the quality of the lines that I am drawing is bad a jagged and therefore I would like to use antialiasing. This is where I fall down. I have searched lots of forum posts and found one comman line of code which is:

GLControl control = new GLControl(new OpenTK.Graphics.GraphicsMode(32, 24, 8, 4));

The problem is I am new to C# and trying to figure where in my code I would put this. I have built my form using the GUI builder in visual studio express and dragged the GLControl from the toolbox to the form.

Is there a step that I am missing to get this to work?

Many thanks in advance for your help.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

What you should do is create your own custom control that inherits from GLControl and sets the AA level in its default (empty) constructor. You can then drag and drop your custom AA GLControl using the GUI designer.

Alternatively, you can create and add your GLControl using code in your main form constructor. (In this case, you won't be able to use the GUI designer to place the GLControl.)

Ysbryd's picture

Thank you so much for your reply. Got the code working and now have anti-aliasing