GL_POLYGON and QT: working after update.. why!?

Hi guys,

I’m using opengl with Qt and I’m working on shapefiles.

Basically, I was taking the shapefile and building the map with OpengGl drawing points, lines and polygons depending on the data retrieved from the shapefile.

The problem was with the GL_POLYGON: it added lines that they shouldn’t be there to close the polygon (I think).

In another computer, now I have just updated all the packages and it seems that this problem isn’t present anymore.

Have you idea of what happened? chich package is the responsible of this behaviour?

Thank you in advance!

Ps I’m on OpenSuse 12.2!

[QUOTE=giello;1255003]Basically, I was taking the shapefile and building the map with OpengGl drawing points, lines and polygons depending on the data retrieved from the shapefile.

The problem was with the GL_POLYGON: it added lines that they shouldn’t be there to close the polygon (I think).
[/QUOTE]
You are aware that GL_POLYGON is limited to convex polygons, right? If you need to draw non-convex polygons, you need to either tessellate them into a set of convex polygons (e.g. using the GLU tessellation routines) or use stencilling.

If you try to draw a non-convex polygon with a single GL_POLYGON call, the results are undefined, and likely to vary according to the hardware and driver.

[QUOTE=GClements;1255013]You are aware that GL_POLYGON is limited to convex polygons, right? If you need to draw non-convex polygons, you need to either tessellate them into a set of convex polygons (e.g. using the GLU tessellation routines) or use stencilling.

If you try to draw a non-convex polygon with a single GL_POLYGON call, the results are undefined, and likely to vary according to the hardware and driver.[/QUOTE]

Ok, I understand. Thank you for your suggestions.

The fact is that in the other computer it works great… very strange…

Which solution do you suggest to use? is there anything already ready in OpenGL?

wouldn’t it possible that OpenGl internal implementation changed in a way to draw concave polygons?

What hardware configs are you testing on?

the one in which tessellation is ok uses an amd FirePro while the other it’s a GeForce, I have to check for the model number

Well, maybe the AMD implementation does tesselation internally. In general, GClements is right and if it works on AMD, they’re probably doing it wrong.

On another note, why exactly do you think you need to use POLYGON?

I understand.

I’m using GL_POLYGON along with GL_LINE_LOOP, GL_LINE_STRIP and others functions… it depends on the shapefile’s data.

Actually, I think the problems are due to GL_LINE_LOOP…

Assuming that the data is static, use the GLU tessellation functions and store the tessellated data.

Ok, thank you. I think I’ll tessellate each polygon on the fly

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.