PDA

View Full Version : NVidia GL_LINE_SMOOTH bug?



grisha
04-27-2003, 06:31 AM
While using glEnable( GL_LINE_SMOOTH ) for drawing nice antialiased wireframe, I found one bug.
Here is how I draw my objects:




void Init() // called only then context created
{
// ...
glEnable( GL_LINE_SMOOTH );
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_POLYGON_OFFSET_FILL );
glPolygonOffset( 1.f, 1.f );
// ...
}

void Draw() // in render function - called for each frame
{
// ... glClear, set up matrices, etc.

// draw filled objects
for( i = 0; i < g_objects.size(); i++ )
{
glColor4ubv( (const GLubyte*)&amp;g_objects[i].m_color );

// PROBLEM HERE -
// glGet*( GL_CURRENT_COLOR ) returns g_objects[i].m_color,
// but triangles draw using color (0.5,0.5,0.5,1) - set in previous frame - see bottom

glVertexPointer( ... );
glNormalPointer( ... );
glDrawRangeElements( GL_TRIANGLES, ... );
}

// draw wireframe objects
glEnable( GL_BLEND );
glDepthFunc( GL_LEQUAL );
for( i = 0; i < g_objects.size(); i++ )
{
glColor4ubv( (const GLubyte*)&amp;g_objects[i].m_wireColor );
// wireframe always has right color
glVertexPointer( ... );
glNormalPointer( ... );
glDrawRangeElements( GL_LINES, ... );
}

glColor4f( 0.5, 0.5, 0.5, 1 );
// ... draw some lines - grid

glDisable( GL_BLEND );
glDepthFunc( GL_LESS );

// ...
}

But if I insert



-8<---------------------
glBegin( GL_LINES );
glEnd();
-8<---------------------

after glColor - where '// PROBLEM HERE ' is placed - all work fine and triangles have right color. -> If GL_LINE_SMOOTH is enabled, then color will be actually set only then drawing lines.

This only happens with GL_LINE_SMOOTH enabled and I didn't find any limitations on LINE_SMOOTH in the gl spec, so I assume this is a bug.

Card: NVidia GF2MX400
Drivers: 43.45 & 40.41
System: WinXP