开发者

How do we get Polygon Antialiasing in OpenGL ES on Android 1.5?

Based on my reading of Ch. 6 in the Red Book, changing the things that need to be changed for ES, I thought the following code sh开发者_Go百科ould have done it:

gl.glEnable(GL10.GL_POLYGON_SMOOTH);
gl.glBlendFunc(GL10.GL_SRC_ALPHA_SATURATE, GL10.GL_ONE);
gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST); // no visible diff
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
gl.glColor4f(1, 1, 1, 1);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);         // first and count

etc.

But the above fails. There is no visible difference in the output, the aliasing artifacts are just as painfully evident as before the calls to glEnable...glHint were inserted.

Actually, what I just described was when I had GL_LINE_SMOOTH in place of GL_POLYGON_SMOOTH. The latter is not even found! So where is it if not in GL10? Or how could it have been left out of OpenGL ES? How are we supposed to draw filled polygons w/ antialiasing if not with GL_POLYGON_SMOOTH?


Without trying it, what you are doing above does not seem incorrect. However, many phones do not actually support anti-aliasing despite the fact that the API does.

You should be able to achieve full screen anti-aliasing by drawing the screen multiple times while jittering the perpective matrix.

See http://www.opengl.org/resources/code/samples/advanced/advanced97/notes/node63.html and this post regarding the same problem on the iPhone

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜