How to get polygon antialiasing to work?

試著忘記壹切 提交于 2019-12-01 07:01:49

问题


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 won't render.

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

It doesn't anti-alias.


回答1:


Try glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST)




回答2:


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.



来源:https://stackoverflow.com/questions/2028342/how-to-get-polygon-antialiasing-to-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!