views:

292

answers:

2

I'm using these function calls:

glEnable(GL_BLEND) glEnable(GL_POLYGON_SMOOTH) glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE)

It doesn't work and wont render.

glEnable(GL_BLEND) glEnable(GL_POLYGON_SMOOTH) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

It doesn't anti-alias.

A: 

Try glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST)

tkerwin
Thank you for the answer.Unfortunately I get:OpenGL.error.GLError: GLError( err = 1280, description = 'invalid enumerant', baseOperation = glHint, cArguments = (GL_POLYGON_SMOOTH, GL_NICEST))No idea what that means but it doesn't like it. I'm using OpenGL with python.
Matthew Mitchell
Oops, it was supposed to be `GL_POLYGON_SMOOTH_HINT`, not `GL_POLYGON_SMOOTH`. I updated my answer.
tkerwin
Thank you but it still does not work. I want to create rounded corners on my 2D game which is why I'm using polygons. It would be nice to have the corners smooth. The line smoothing works. No idea why this doesn't.
Matthew Mitchell
Rounded corners? That's not really what polygon anti-aliasing is designed to do, it's supposed to fix jagged edges. The corners should still be more or less sharp, like here: http://www.databasesandlife.com/blog-attachments/20080320-polygon-1.png .
tkerwin
A: 

This is a mundane answer.. but if you want rounded corners, you'll probably want to use more more vertices at the corners and place them for a more rounded shape. You could also look into doing this procedurally.. but if you're doing a game and you want to get it finish, I'd usually recommend that you have the final vertex position in the data (unless you have a compelling reason to make it dynamic).

Alternatively, you can use a texture with a rounded appearance near the corners. This is gradually becoming less popular as video hardware becomes more powerful, but is still quite effective.

guesser