Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: how to render the edges smoother?

  1. #1
    Junior Member Newbie
    Join Date
    May 2017
    Posts
    4

    how to render the edges smoother?

    hello guys,

    I wrote a program to display some pressure-measurements. I've oriented to a terrain map. The problem is that the edges are too rough. I draw the vertexes with triangles_strip. Do you have any idea how to draw it smoother?

    Click image for larger version. 

Name:	Rundung Opengl.jpg 
Views:	32 
Size:	2.6 KB 
ID:	2440

    My Code.

    Code :
    for (int x = 0; x < width - 1; x++)
                {
                    gl.ShadeModel(OpenGL.GL_SMOOTH);
                    gl.Begin(OpenGL.GL_TRIANGLE_STRIP);  //Definition der des Dreiecksflächentyps 
                    for (int y = 0; y < height - 1; y++)
                    {
     
                                    //    //draw vertex 0
                                gl.TexCoord(0.0f, 0.0f);//    gl.Normal3i(0, 0, 0);
                                Color color = GetBlendedColor((int)(pressures[x, y]));  //zuorden welche farbe gezeichnet werden soll
                                gl.Color(color.R, color.G, color.B);
                                gl.Vertex((float)x, -y, pressures[x, y]);  //gl.Vertex(x,y,z)= allg. Form der Eckpunktdefinition
     
                                //    // draw vertex 1
                                gl.TexCoord(1.0f, 0.0f); // oder gl.Normal3i(1, 0, 0);
                                color = GetBlendedColor((int)(pressures[x + 1, y]));
                                gl.Color(color.R, color.G, color.B);
                                gl.Vertex((x + 1), -y, pressures[x + 1, y]);
     
                                // draw vertex 2
                                gl.TexCoord(0.0f, 1.0f); // oder gl.Normal3i(0, 1, 0);
                                color = GetBlendedColor((int)(pressures[x, y + 1]));
                                gl.Color(color.R, color.G, color.B);
                                gl.Vertex(x , -(y + 1), pressures[x, y + 1]);
     
                        //    // draw vertex 3
                        gl.TexCoord(1.0f, 1.0f);  //oder  gl.Normal3i(0, 0, 1);
                        color = GetBlendedColor((int)(pressures[x + 1, y + 1]));
                        gl.Color(color.R, color.G, color.B);
                        gl.Vertex((x + 1), -(y + 1), pressures[x + 1, y + 1]);
                    }
                    gl.End();
                        }

  2. #2
    Member Regular Contributor
    Join Date
    Jul 2012
    Posts
    460
    Since nobody seems to have a clear answer to give to you (probably due to the fact that your post is vague), I'll try to give some hints:

    To my opinion you have 2 possibilities:

    1) Do it a the data level so that you have a finer granularity. So you'll end up with more little triangles.
    2) Do it as an imaging trick with enabling multi-sampling.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •