Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

jiangcaiyang

Member Since 02 Nov 2010
Offline Last Active Dec 21 2012 06:16 AM
-----

Topics I've Started

Same vertices and different drawing sequences cause invisibility

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?


glGetError function needs linking library, I don't know its name

13 October 2012 - 01:58 AM

I am currently working in Linux, and using g++ as my compiler, the ld return this information:
(.text.startup+0x3b):-1: Error:undefined reference to `glGetError'
I don't know what library to link.

PARTNERS