Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#Actualjiangcaiyang

Posted 21 December 2012 - 06:01 AM

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:


111_zps49effd85.png

222_zps38c3d6f8.png

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?


#1jiangcaiyang

Posted 21 December 2012 - 05:39 AM

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 );

1356089395_4923.pngHowever, it looks like this:

1356089395_4923.png

1356089395_3230.png

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?


PARTNERS