Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Same vertices and different drawing sequences cause invisibility

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 jiangcaiyang   Members   

108
Like
0Likes
Like

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

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?


Edited by jiangcaiyang, 21 December 2012 - 06:01 AM.


#2 jiangcaiyang   Members   

108
Like
0Likes
Like

Posted 21 December 2012 - 06:17 AM

Oops there is a small mistake in my code.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.