opengl es strange 16bit texture scale problem - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: opengl es strange 16bit texture scale problem (/thread-8092.html)
opengl es strange 16bit texture scale problem - spuckfunkel - Sep 9, 2010 01:10 PM
hi every one,
i am actually developing my first 2D iphone game and render all graphics in opngl 16bit. this is how the game looks like at the moment:
for the background i use a 1024x1024 texture (which i generate during the game). the whole gameworld can be zoomed out but while this happens strange patterns (like Moiré patterns http://en.wikipedia.org/wiki/Moir%C3%A9_pattern) appear on the background texture. it is hard to discribe and i cant screenshot it, because it only happens if the image is steadily scaling (relative fast).
if i set the GL_TEXTURE_MIN_FILTER & MAG_FILTER parameter of the texture to GL_NEAREST the effect happens stronger so i guess it has to do with the scaling algorithm of opengl and 16 bit. even if the texture is a plain color the "moiree" effect is happening when scaling the texture. on the simulator the effect is less stronger (hard to see) than on the iphone (obviously annoying).
does anybody know this effect and have a suggestion how i can solve it? when i use 32bit textures the effect does not appear but that is no solution for me.
many thanks and greetings
RE: opengl es strange 16bit texture scale problem - OneSadCookie - Sep 9, 2010 02:46 PM
using mipmaps should eliminate the problem.
RE: opengl es strange 16bit texture scale problem - spuckfunkel - Sep 9, 2010 03:20 PM
i am using mipmaps... but i did not set the GL_TEXTURE_MIN_FILTER to GL_LINEAR_MIPMAP_LINEAR. now it works the patterns are gone. thanks for your advice it leaded me to proove the mipmap thingie.
have a nice day
RE: opengl es strange 16bit texture scale problem - OneSadCookie - Sep 9, 2010 03:50 PM
You may wish to consider LINEAR_MIPMAP_NEAREST, it's usually faster, and the difference may not be noticeable in your case.
RE: opengl es strange 16bit texture scale problem - mariocaprino - Sep 10, 2010 12:42 AM
It sounds to me like you are referring to 16bit colour banding? Especially if the problem disappears when you increase the colour depth.
The easiest solution would be to accept that you need to increase your colour depth. Remember that you can mix and match between 32bit textures and 16bit renderbuffers, or the other way around - maybe you can find a compromise.
If you are still unwilling to increase your colour depth you could look into dithering patterns.
Quick edit: Ooops... reread the thread and noticed that mipmaps had solved the problem.
RE: opengl es strange 16bit texture scale problem - spuckfunkel - Sep 10, 2010 03:20 AM
oh the LINEAR_MIPMAP_NEAREST works too very well. i thoughted that when i am using mipmaps an set the parameter only to GL_LINEAR the mipmap blending is NEAREST by default. but it seems so if i only set GL_LINEAR (and not LINEAR_MIPMAP_NEAREST) that there ist no mipmap blending wich caused the problem.
i do mixing 32bit and 16bit but for the background two images at 1024x1024 in 32bit would be consume too much memory.
the dithering was no problem, because the effect also appeared when i am using only a plain colour.
but thanks for your advice.
have a nice day
RE: opengl es strange 16bit texture scale problem - headkaze - Aug 14, 2011 10:44 PM
I wonder what happend to this little game?