OpenTKstart's picture

Smooth Visual Effect

Hey,

is there a way to smooth the Visual Optic of a Graphic Object in OpenTK.
Like this:

            GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest);
            GL.Hint(HintTarget.PolygonSmoothHint, HintMode.Nicest);

But i dont see any effect...

Thx


Comments

Comment viewing options

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

you are using old stuff. try to create a MSAA opengl context instead.

thorrablot's picture

And, if you are using the compatibility profile (the "old stuff") - you can refer to this information for anti-aliasing lines and polygons:

http://www.opengl.org/resources/code/samples/sig99/advanced99/notes/node119.html

For instance, this OpenTK fragment works for lines:

                GL.Enable(EnableCap.LineSmooth);
                GL.Enable(EnableCap.Blend);
                GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
                GL.Hint(HintTarget.LineSmoothHint, HintMode.DontCare);
OpenTKstart's picture
thorrablot wrote:

And, if you are using the compatibility profile (the "old stuff") - you can refer to this information for anti-aliasing lines and polygons:

http://www.opengl.org/resources/code/samples/sig99/advanced99/notes/node119.html

For instance, this OpenTK fragment works for lines:

                GL.Enable(EnableCap.LineSmooth);
                GL.Enable(EnableCap.Blend);
                GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
                GL.Hint(HintTarget.LineSmoothHint, HintMode.DontCare);

Wow, thats pretty good! But just to understand this better. Am i using MSAA by using the code you have posted or is it still "old-stuff". If yes, how can i use MSAA?

thx

thorrablot's picture

That's the "old-stuff", and will only apply anti-aliasing to the line primitives.

I haven't used MSAA, however, if you look in the OpenTK Sample Browser, in the OpenTK samples, there is a sample named "GameWindow MSAA"

The main item is the specification of 4 samples in the GraphicsMode construction of the OpenTK GameWindow:

        public FullscreenAntialias()
            : base(800, 600, new GraphicsMode(32, 0, 0, 4))
        {
            Keyboard.KeyDown += Keyboard_KeyDown;
        }

Have fun!