2 Replies Latest reply on Dec 12, 2016 9:31 AM by mksrksh

    OpenGL: glEdgeFlag not working properly under certain circumstances

    mksrksh

      Hello Devgurus,

       

      in some cases the call to glEdgeFlag with GL_FALSE as parameter seem to fail if used inside of display lists.

       

      To reproduce the wrong behaviour just create the simplest glut example (console) application and set the following function for the display routine callback:

       

      void display(void) 
      {
        static GLint list = 0; 
        if (!list) 
        {
        list = glGenLists(1); 
      
        glNewList(list, GL_COMPILE); 
      
        glPushMatrix(); 
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 
      
        glBegin(GL_TRIANGLES); 
        glEdgeFlag(GL_TRUE); 
        glVertex3d(-100.0, -100.0, 0.0); 
        glEdgeFlag(GL_FALSE); 
        glVertex3d(100.0, -100.0, 0.0); 
        glEdgeFlag(GL_TRUE); 
        glVertex3d(-100.0, 100.0, 0.0); 
        glEdgeFlag(GL_FALSE); 
        glVertex3d(-100.0, 100.0, 0.0); 
        glEdgeFlag(GL_TRUE); 
        glVertex3d(100.0, -100.0, 0.0); 
        glVertex3d(100.0, 100.0, 0.0); 
        glEnd(); 
      
        glPopMatrix(); 
      
        glPushMatrix(); 
        glTranslated(-160, 0, 0); 
      
        if (true) // set it to false to make glEdgeFlag to work properly
        {
        glBegin(GL_LINES); 
        glVertex3d(0, 0, 0); 
        glVertex3d(0, 50, 0); 
        glEnd();
        } 
        glPopMatrix(); 
      
        glEndList(); 
        } 
      
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
        glColor3f(1.0, 1.0, 1.0); 
        glCallList(list); 
      
        glutSwapBuffers();
      }
      

       

      What I would expect to see if I run the application is just an outline of a rectangle and a line, please find right.png attached. But on the AMD graphic adapters there is a diagonal line inside the rectangle, see wrong.png. This line should be suppressed by the call to glEdgeFlag in line 16 which does not work.

       

      As a side note if you do not draw the last stand alone line (set if statement to false in line 32) or if you do not use display lists at all glEdgeFlag works fine and the diagonal line disappears.

       

      Tested with current drivers on:

      Windows 8.1 (64bit)

      Windows 7 (64bit)

      AMD Radeon R7 200 Series

      AMD FirePro W2100

       

      Thank You in advance and kind regards