Polygons are not drawn perfectly in Opengl Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
jjoe
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun May 28, 2006 10:46 pm

Polygons are not drawn perfectly in Opengl

Post by jjoe »

Hello,

My program uses wxGLCanvas and GLUT to draw polygons. It works great on my own computer.
However, the drawing window has different results when I execute the program on other machine.

Image

Image


The first picture shows the result on my computer, and the second pic shows the results on other computer. There is space between triangles in the second pic. I use gluPartialDisk() to draw the circle, so it's not the floating round off problem.

I use wxWidgets 2.6.3 and VC 2005 express to build the program in static library mode. I tried to copy glut32.dll to other computer, but the results are the same. Can sb tell me what the problem is?
terranim
Experienced Solver
Experienced Solver
Posts: 56
Joined: Fri Jun 10, 2005 3:48 pm
Location: UK
Contact:

Post by terranim »

Hi jjoe,

I got this exact same problem in an application I was writing last year. It seems to be a problem with using the smoothing options in OpenGL.

I had this code in my OpenGL initialisation function:

Code: Select all

glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
But found if you comment out the lines to do with polygons and just leave line anti-aliasing in then it solves the problem:

Code: Select all

glEnable(GL_LINE_SMOOTH);
//glEnable(GL_POLYGON_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
//glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
Regards,
Dan
Post Reply