alex_konnen's picture

GL.Enable(EnableCap.PointSmoot) seems not to work for me

Hello,
I am absolutely new on this list and also relatively new in what concerns OpenTK.
I am trying to render a simple array of 3D points which is not a problem, only that the points always remain rough square, although I apply a
GL.Enable(EnableCap.PointSmoot)
while rendering, like follows:

GL.Enable(EnableCap.PointSmooth);
GL.PointSize(mySize);
GL.Color4(myColor);
 
GL.Begin(BeginMode.Points);
GL.Vertex3(myVertex);
GL.End();

What could be the reason of this behavior? Is there anything I am doing wrongly?
Thanks in advance,
Alex

Inline Images

Comments

Comment viewing options

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

When I use PointSmooth it seems to work ok...it's not 'pretty' rounding but does sort of what you'd expect). I'm not sure what else is in your OnRenderFrame function but here's a simple test

        protected override void OnRenderFrame(FrameEventArgs e)
        {
            GL.Clear(ClearBufferMask.ColorBufferBit);
            GL.PointSize(20f);
            GL.Enable(EnableCap.PointSmooth);            
            GL.Begin(BeginMode.Points);
            GL.Color3(Color.Red);
            GL.Vertex3(-0.5f, 0.5f,0);
            GL.Color3(Color.Red);
            GL.Vertex3(0.0f, -0.5f,0);
            GL.Color3(Color.Red);
            GL.Vertex3(0.5f, 0.5f,0);
 
            GL.End();
 
            this.SwapBuffers();
        }

This isn't a question unique to OpenTK though, so here's a link to a related StackOverflow discussion regarding the C OpenGL implementation: http://stackoverflow.com/questions/1513811/getting-smooth-big-points-in-...

alex_konnen's picture

Thanks wolfsnipes,
I tried your snippet, and it did not work for me (see picture).

I am working under Windows 7, 64 bit, .NET 4.0, OpenTK v2.0.50727.

As for the stackoverflow example, it seems promising; many thanks; I will have a look at it and report what happened.

Alex

AndyKorth's picture

A lot of those gl primitives tend to have poor support.

http://www.opengl.org/wiki/Common_Mistakes#Point_and_line_smoothing

Smoothed line and point drawing either tend not to work, work very slowly, and definitely look different on different hardware.

alex_konnen's picture

Hello,
I found a trivial solution in "3-D Computer Graphics" by Samuel Buss:

static void gw_RenderFrame(object sender, FrameEventArgs e)
        {
            GL.Clear(ClearBufferMask.ColorBufferBit);
            GL.PointSize(20f);
 
            // *** Below are the four lines that you need to make your points round! *** //
            GL.Enable(EnableCap.PointSmooth);  
            GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
 
            GL.Begin(BeginMode.Points);
            GL.Color3(Color.Red);
            GL.Vertex3(-0.5f, 0.5f,0);
            GL.Color3(Color.Red);
            GL.Vertex3(0.0f, -0.5f,0);
            GL.Color3(Color.Red);
            GL.Vertex3(0.5f, 0.5f,0);
 
            GL.End();
 
            gw.SwapBuffers();
        }

Alex