Sign in to follow this  
Emre BURHAN

glPolygonMode: GL_LINE, glEdgeFlag problem on some ATI cards

Recommended Posts

Emre BURHAN    122
On my ATI RADEON HD2600 PRO card, if I use glPolygonMode with GL_LINE and use glEdgeFlag, - the rendering time takes a few seconds for a single frame for my test application. - Display is wrong: there is no hidden line removal for edges, ie all lines are rendered despite some of them are obscured by some objects. If I use GL_FILL for glPolygonMode or do not use glEdgeFlag, it is 1600 FPS for my test application and hidden line removal is working too. I can provide full project files or screen shots on demand and if someone explains me how to add screen shots and files to forum posts ;) Every other machines with graphics card other than RADEON HD2600 PRO, I have tried works w/o any problems. Any ideas? Thanks. void cube() { glBegin(GL_QUADS); // just a toggle glEdgeFlag(false); glEdgeFlag(true); // Front Face glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); ... glEnd(); } int DrawGLScene(GLvoid) { ... // first pass: draw polygons only { glEnable(GL_TEXTURE_2D); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); cube(); } // second pass: draw edges only { glDisable(GL_POLYGON_OFFSET_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glColor4f(1.0f, 0.0f, 1.0f, 0.5f); cube(); } ... }

Share this post


Link to post
Share on other sites
sprite_hound    461
Quote:
Original post by Emre BURHAN
- the rendering time takes a few seconds for a single frame for my test application.
- Display is wrong: there is no hidden line removal for edges, ie all lines are rendered despite some of them are obscured by some objects.


When I use GL_LINE polygon mode I also get slower performance than with GL_FILL (with an 7600GT). (but not that slow).

I trust you're not clearing the depth buffer between passes or something? (because when you only render lines, they obviously don't obscure other lines much). Though if what you do works on other cards then I doubt you're doing anything wrong.

You need to upload images to imageshack.us or something similar, then you can put them here with the html < img > tags or a link you get provided with on uploading.

Share this post


Link to post
Share on other sites
Emre BURHAN    122
glEdgeflag switched OFF (NORMAL operation)

Free Image Hosting at www.ImageShack.us

glEdgeflag switched ON (BAD operation)

Free Image Hosting at www.ImageShack.us

Please note that depth test is working normally for polygon fills (first pass) but not for contours (2nd pass)

Here is the benchmark applied to machines here in our office:
graphics card_____________edgeflag OFF__edgeflag ON
ATI RADEON HD2600 PRO_____1568__________<1
NVIDIA GEFORCE 8600 GT____2975__________2975
NVIDIA GEFORCE 6600 GT____1640__________1640
NVIDIA GEFORCE 7600 GT____2630__________2630
ATI RADEON 9600___________750___________750
ATI RADEON X600___________760___________760
NVIDIA GEFORCE FX 5200____240___________240

Share this post


Link to post
Share on other sites
sprite_hound    461
Quote:
Original post by Emre BURHAN
Please note that depth test is working normally for polygon fills (first pass) but not for contours (2nd pass)


Maybe I'm misunderstanding, but I'd have thought you'd need depth testing for the lines (against the polygons already drawn) in order for them to be obscured the way you seem to want.

I've never used EdgeFlag, but looking at the man page it seems to indicate that having edge flag off with PolygonMode as GL_LINE marks them as non-boundary so they won't be drawn. This isn't what happens in the first screenshot...

Could you explain what you are actually trying to do?

Share this post


Link to post
Share on other sites
Emre BURHAN    122
Quote:
Original post by sprite_hound
Maybe I'm misunderstanding, but I'd have thought you'd need depth testing for the lines (against the polygons already drawn) in order for them to be obscured the way you seem to want.

Sure, depth test should be on everytimes, and it is.

Quote:
Original post by sprite_hound
I've never used EdgeFlag, but looking at the man page it seems to indicate that having edge flag off with PolygonMode as GL_LINE marks them as non-boundary so they won't be drawn. This isn't what happens in the first screenshot...

Yes, glEdgeFlag works that way.
Though, the first screen shot is correct: All edges are set visible(ie glEdgeFlag is true) and depth testing is on, so edges obscured by the cube faces towards the viewer are not drawn.
The second shot: Exactly the same settings as the first one, (all edges are set visible and depth testing is on) the only difference is just a toggle: glEdgeFlag(false); glEdgeFlag(true); right after, but the visual is incorrect: edges obscured by faces are drawn despite they shouldn't be.
Quote:
Original post by sprite_hound
Could you explain what you are actually trying to do?


A simple rendering with contour edges. This is achieved by two passes: one for polygon faces drawn with polygonmode GL_FILL and polygonoffset enabled, and the second pass is with polygonmode GL_LINE and polygonoffset disabled. Depth test is always enabled.

This is a test application I have built to show the problem. The visual should be the same in two shots: edges that are not obscured by any faces or lines should be visible. Both shots run the same code with only one difference: Second shot sets edgeflag to true, right after setting it to false.
Also, any other graphics cards I have tried renders the two exactly the same, and the same speed.

code for first shot:
void cube()
{
glBegin(GL_QUADS);

// Front Face
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
...
glEnd();
}

code for the second shot:
void cube()
{
glBegin(GL_QUADS);

// just a toggle
glEdgeFlag(false);// <--1. COMMENT THESE TWO LINES AND RENDER WILL BE CORRECT
glEdgeFlag(true);// <--2.

// Front Face
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
...
glEnd();
}

Share this post


Link to post
Share on other sites
Emre BURHAN    122
Problem fixed via latest driver published on May 21, 2008 (yesterday)
Catalyst Display Drivers version 8.5

two shots are the same now, and rendering time is ok.
new benchmark:
ATI RADEON HD2600 PRO_____1638__________1610

Thank you, sprite_hound

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this