I want to draw a surface comprising triangular faces. Each point forming the triangular faces has different colors arranged. The codes are as follows.
However, it looks that the surface displayed is not SMOOTH with many sawtooths (color sawtooths).
How can I do?
The decision for your problem is
That thing you’ve done actually does polygon edge smoothing, it doesn’t affect color interpolations.
Originally posted by Jackis:
[b]The decision for your problem is
That thing you’ve done actually does polygon edge smoothing, it doesn’t affect color interpolations.[/b]
Thank you first.
But I have used glShadeModel(GL_SMOOTH). The colors, especially at the edges of different colors, are still not SMOOTH. There are many color sawtooths.
Thank you again.
Could you post a screenshot, please??
It will be much clearer for me, what’s the problem exactly.
whats your graphics card?
ok from the image it looks like you have a problem when defining color for each vertex.
I would try to check how is the color array filled vs. how is it read.
IBM Intel® Pentium® with Intel® 82858/82855 GM/GME Graphics Controller.
The color of each vertex filled mainly depends on the z-value of the vertex. The different z-value will be assigned a different color.
It is very unlikely that this is caused by a driver/implementation bug.
When I asked “how” I meant “in which order”.
To debug this you may set all vertices colors the same, then a keypress change color on a element in
Color[i][j] array. Then have others key to change i,j, and see how the color changes.
And try displaying in wireframe, to better spot how the triangles are drawn.
Some inspirations on heigthfields :
And try triangle or quad strips, better performance :
You have a problem displaying a smooth color gradient - your graphics setting is probably for 256 or 65535 colors, which can cause such effects. Try changing to 24- or 32-bit depth.