UPDATE:
I have located it to when I install NVIDIA Control Panel, if I uninstall it it works properly.
When you rotate a quad in OpenGL the edges become jagged.
If I call glEnable(GL_POLYGON_SMOOTH) the edges become smooth, but OpenGL then draws a white diagonal line through all my images as if it's creating trisout of my quads.
This is how it looks:
Is there a way to disable that line, or can I get antialiasing in another easy way? I tried GL_MULTISAMPLE but nothing happened.
In my code I have also:
glShadeModel(GL_SMOOTH);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Ok, I'll write this up as an answer, let me know if it works after trying it out.
GL_TRIANGLE_FAN: If the application specifies a sequence of vertices v, OpenGL renders a triangle using v 0, v 1, and v 2; another triangle using v 0, v 2, and v 3; another triangle using v 0, v 3, and v 4; and so on. If the application specifies n vertices, OpenGL renders n–2 connected triangles.
So to draw a unit quad centered around the origin,
glBegin(GL_TRIANGLE_FAN);
glTexCoord2f(0f, 0f);
glVertex3f(-halfWidth, -halfHeight, 0f);
glTexCoord2f(0f, 1f);
glVertex3f(-halfWidth, halfHeight, 0f);
glTexCoord2f(1f, 1f);
glVertex3f(halfWidth, halfHeight, 0f);
glTexCoord2f(1f, 0f);
glVertex3f(halfWidth, -halfHeight, 0f);
glEnd();
Now you can put the same transformations around this that you used around your quad! Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With