Hi, I’m new around here and I’m not an OpenGL guru since I just started learning OpenGL ES 2.0 on Android (so please be patient )
One of the biggest problem I’m having with OpenGL ES is the lack of native antialias support (please correct me if I’m wrong), here it is a sample of my bad looking application (it’s a desktop application running OpenGL ES 2.0 in “emulation mode” thanks to a middleware API).
No antialias
I have read many articles about antialias (some oriented to “specif tasks” like this one), but I’m looking for a generic and easy to use implementation.
The two only options available for my requirements, as far as I know, are:[ul][li]Supersampling[*]Postprocessing shaders like FXAA, MLAA etc…[/ul][/li]Supersampling was easy thanks to the library I’m using:
Supersampling 1.5x
Supersampling 2x
Even if supersampling works great and have a good looking result (on the PC), soon I discovered that has very bad performance on “mobile” side and I started looking at the second option
FXAA 3.11
FXAA (which is known to be fast) has the best looking result but I’m still not able to make it works on my phone (it works on PC but not on the phone due to a shader error) and that’s why I’m writing here today. As I wrote above, my experience with shaders is very limited and I’m not able to track the “real” problem.
Can anyone tell me if FXAA can run in OpenGL ES 2.0? If not, is there any chance to use something similar which is supported for that target? Maybe MLAA?
Sorry for being “too generic” there but my original intent was to understand if FXAA/MLAA/etc are supported on OpenGL ES 2.0.
Anyway I have problems in getting a detailed error message when I run the application on my device (no probs on PC): the call to GL_COMPILE_STATUS gives me a return value of 0 which means an error, but GL_INFO_LOG_LENGTH always return 0 and I cannot track the message. After lots of #ifdef in the fragment shader, I suspect that the problem is in a call to “texture2DLod” that is probably not supported. Anyway, as I wrote above, I’m interested in understating if a post processing filter for AA is in general supported in OpenGL ES 2.0.
As usual, it was very hard to debug since on error I got no message from OpenGL…As suggested by ZbuffeR, all references to texture2DLod has been changed to texture2D and I made some small changes in the code shared in my last post too.
Btw I got a very very bad frame rate (1fps vs ~30fps ), could it be caused by swapping texture2DLod with texture2D? I’m really noob with this…any other suggestion to increase the fps?
Thanks anyway for your help
Read http://www.opengl.org/wiki/Performance
You can try commenting out various parts of the shader to see how it improves performance, but my understanding is that your hardware is not powerful enough period.
Speaking of hardware, what are your specs ? By any chance, can you run it on a different phone ?
Thanks for the link, I’ll keep testing the shader.
About specs, I know that my phone is not a “recent” model (details here), anyway I should be able to make some tests on other devices.
Thanks again for the support
Yes that’s right: are you telling me that there is no chance to have a good frame rate on my device? I cannot exclude devices with the same specs for my “target”. Can you suggest something better for my purpose?
Thanks as usual
Do not use polygons, use textured quads with transparent edge, it will be much faster and still be nicely filtered.
Less generic that FXAA of course, but you don’t have a lot of choice for this hardware.
EDIT : can you use GL_POLYGON_SMOOTH on GL ES 2.0 ? It could be worth a try. Here are the calls needed to enable this feature on regular GL (modern computer cards no longer implement it, only GL_LINE_SMOOTH seem to work) :
EDIT : can you use GL_POLYGON_SMOOTH on GL ES 2.0 ? It could be worth a try. Here are the calls needed to enable this feature on regular GL (modern computer cards no longer implement it, only GL_LINE_SMOOTH seem to work) :
Yes, I had a look at those links in the past but the simplicity (I mean easy to use) and quality result of a FXAA is very attractive
As I wrote in the first post, my original idea was finding a “generic” way for antialias in OpenGL ES.
Thanks anyway for the suggestion