I am trying to display a 3D cube or other similar entity. I noticed that the top face of the cube (in an isometric type view) is being displayed with a jagged edge through which I can see a portion of the polygon making up the back face(s). I have enabled GL_POLYGON_SMOOTH, but that doesn’t seem to work. Does anyone know how to fix this problem so that I don’t get conflicts along corners of my 3D objects?
Have you tried to call glHint also? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc03_9uno.asp
My guess is that you will get antialiasing but that it will be very slow. If you have a newer card with full screen anti aliasing, FSAA, will that probably be a better idea.
I think this is because of the z fighting between the back facing polygon and the front facing. You can do back face culling - glEnable(GL_CULL_FACE) or decrease the far view plane distance to get more accurate z buffering - gluPerspective(…).
doing back face culling will also increase the rendering speed.
[This message has been edited by ctoa (edited 07-19-2003).]
Okay, I’m about to show my “beginner” status again, but what the heck…I’m a beginner. I’m working on a simulation of Jupiter and it’s four major moons. I draw everything in the XY-plane and then effectively rotate the entire scene with gluLookAt() by using an up vector of (0, 0, 1), so I get an “edge-on” view of the system. So, if I want to sort my objects back-to-front using their Z-values to help with anti-aliasing, I’m really using my objects’ Y-values since they’re all in the XY-plane, right? Or for Z-buffer purposes, is my Y-axis acting as the Z-axis because of the gluLookAt() rotation?
FYI, the reason I draw in the XY-plane as opposed to the XZ-plane is because in a separate viewport, I render a 2-D miniature “heads-up” view of the planet/moon system using gluOrtho2D, GL_POINTS, and glVertex2d(), to which I simply pass the x and y coordinates of each object.
Drawing order sorting is not done in object but screen coordinates.
You need to apply the modelview and projection matrix to the polygons and sort by resulting z.
Polygon smoothing is a weird feature. I would recommend to try full scene antialiasing (FSAA) or multisampling instead.
FSAA is just a flick of a switch in your vendor’s control panel, you just render your scene as usual, easy as that.
Multisampling needs to be selected via WGL_ARB extensions pixelformat and multisample.
[This message has been edited by Relic (edited 07-21-2003).]
FSAA did the trick. Is there a way to set this in software, similar to the way waiting for vsync is set and unset?
Yes, if supported by your OpenGL implementation with the extensions in my last sentence from above.
See http://oss.sgi.com/projects/ogl-sample/registry/ for the specs. You might to look up some examples on the developer pages of your graphics vendor.
Thanks, Relic. I think it’s time I learned about the OpenGL extension mechanism. I’ve been using the basic API up until now.