3D object draw/hidden surfaces .....

why do you said this? GL_FLAT does not disable interpolation between vertices, in fact it really permits to see if your normals are pointing correctly.it is a “sketching” manner to see your model.

The GL_FLAT was not removed

With flat shading, the color of one particular vertex of an independent primitive is duplicated across all the primitive’s vertices to render that primitive.
With smooth shading, the color at each vertex is treated individually. For a polygon primitive, the colors for the interior of the polygon are interpolated between the vertex colors.

The provoking vertex of a primitive is the vertex that determines the constant primary and secondary colors when flat shading is enabled. In OpenGL, the provoking vertex for triangle, quad, line, and (trivially) point primitives is the last vertex used to assemble the primitive. The polygon primitive is an exception in OpenGL where the first vertex of a polygon primitive determines the color of the polygon, even if actually broken into triangles and/or quads. Since May 11th of the previous year, provoking vertex can be changed by using GL_EXT_provoking_vertex extension.

Even if all verices in the primitive share the same material properties and have the same normal (i.e. it is a flat surface), depending on the distance from the light and other parameters, flat shading will not give the same results as smooth, because the final color of the pixels are not interpolated across the primitive.

P.S. I’m glad that Irena is finally find the error, and that I’m right about the reason. :wink:

Aleksandar,
Thank you!!!

May be you can advice me regarding the normal issue?
Thanks

I would like to help if I only know how. :slight_smile:

Well your problem is how to determine front-facing side of the polygons. The best way is to keep order of specifying vertices consistent. Always draw vertices in the CCW direction (viewed from the outside). Try and check if it works.

I get the mesh description from the file (PLG)
So the order (incinsistent) is already (pre)defined and I can`t know about the direction…

It is not very hard to determine the direction in which vertices are defined.
This is the code I’m using for determining orientation in 2D, where no is the number of vertices in the polygon

bool C3DB::CCW_Orientation()
{
	double s = 0.0;
	for(unsigned int i=0; i<no; i++)
	{
		s += ( (x[i%no] * y[(i+1)%no]) - (x[(i+1)%no] * y[i%no]) );
	}
	if( s >= 0 ) return true;
	else return false;
}

It can be generalized for 3D also. Everything is much simpler for triangles only, and if you are using vector-product, but you said that this is prohibited.