PDA

View Full Version : how to render the edges smoother?



Kleinstein
08-08-2017, 04:55 AM
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?

2440

My 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();
}

Silence
08-10-2017, 12:32 AM
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.