Reputation: 337
Engine : LWJGL
SO , I am wondering , how do I draw a triangle's back face? I know there is something going on with the
glTexCoord();
method(s), but I can not understand in which way I need to do this.
Upvotes: 1
Views: 95
Reputation: 45352
The facing of a triangle has nothing to do with texture coords. It is solely defined by the winding of the vertices in window space.
By default, GL uses the rule that if the three vertices (in the order as they are specified when drawing) are seen - in the final picture - in counter-clockwise order, then this is treated as the front face. This facing rule can be changed via glFrontFace()
. Furthermore, the GL can be told do never draw a specific face via glEnable(GL_CULL_FACE)
. Which faces are culled is controlled by glCullFace()
. Typically, backface culling is used for closed objects (wihtout transparency), as in such cases, the back-facing triangles are never seen and do not need to be processed.
So to control the facing of your triangles, the order in which the vertices are specified does matter. Furthermore, the transformations you use define which side you are actually seeing.
The winding should especially be consistent inbetween and across objects. Two triangles sharing an edge, like triangles A,B,C and B,C,D, have a consitent winding if the shared edge is specified in mutually ireverse order. That is, if you specify the first triangles vertices in the order A,B,C, you must specify the vertices of latter triangle in a way such that C,B is used, like C,B,D or D,C,B, or B,D,C.
Upvotes: 1