I am currently doing my personal experiment named Maze3D. The problem looks like this: In OpenGL there is a term: Cull Mode.
I am currently using glFrontFace( GL_CW ); glEnable( GL_CULL_FACE ); and using same vertices to draw a double-side wall:
void DrawInnerWall( Point3F& p1, Point3F& p2, Point3F& p3, Point3F& p4 )
{
glTexCoord2f( 0.0f, 1.0f ); glVertex3fv( p1 );
glTexCoord2f( 1.0f, 1.0f ); glVertex3fv( p2 );
glTexCoord2f( 1.0f, 0.0f ); glVertex3fv( p3 );
glTexCoord2f( 0.0f, 0.0f ); glVertex3fv( p4 );
}
void DrawOuterWall( Point3F& p1, Point3F& p2, Point3F& p3, Point3F& p4 )
{
glTexCoord2f( 1.0f, 1.0f ); glVertex3fv( p1 );
glTexCoord2f( 0.0f, 1.0f ); glVertex3fv( p2 );
glTexCoord2f( 0.0f, 0.0f ); glVertex3fv( p3 );
glTexCoord2f( 1.0f, 0.0f ); glVertex3fv( p4 );
}
I am using
DrawInnerWall( p8, p7, p3, p4 );
DrawOuterWall( p7, p8, p4, p3 );
However, it looks like this:
The maze and arrow are currect, but in a 2D view, there is no wall but in 3D view we can see a wall clearly.
In other case, same vertices and different drawing sequences cause invisibility. Could you please figure out the problem?