The title says it all. What I’m up for is making a 2d platformer game in which the zoom of the camera would be adjusted for each level. When I implemented this feature, everything that I render started to shimmer once OpenGL has to pick a pixel out of few pixels. I googled it and I found that the way to fix something likes this is with specific texture filtering. However, I tried few of them and none of them seemed to work the way I wanted them to. They make the shimmering go away, however since I’m using 8x and 16x textures mainly, it causes them to be blur, which is another thing I don’t want. When I use GL_NEAREST as my mag, min filter, there is shimmering. When I use GL_NEAREST_MIPMAP_NEAREST, for some reason textures look as if they are filtered with GL_LINEAR filter.
So the thing I’m trying to accomplish is fix shimmering once zoom in/out and keep the blockiness of the textures.
Hmm something doesn’t seem right. Can’t seem to find the solution for shimmering without making textures linear, which I don’t want. Does anybody know how does opengl scale everything to full screen when resolutions is much lower than that of full screen? I have 12801024 monitor, and when I run my game in 640 * 480 resolution full screen, there is no shimmering. When I try to make my opengl Canvas (glOrtho) with 640 * 480 dimensions onto 12801024 window, I get shimmering. Does opengl automatically adjust something when switching to full screen? Because it seems to be the perfect solution I would be looking for.
Just magnify your source image and make a texture from it that for example is 4x4 the size. So that each source image pixel fills 4x4 Pixels of the texture. Then you can use texture filters, without losing the pixel stile look from to much blur.
The solution to shimmering is to move everything in integer multiples of a screen pixel, so that the sample locations remain fixed. If you move objects by fractions of a pixel, the alignment of the screen pixel grid to the texture pixel grid will change, which causes the shimmering.
In this situation, OpenGL doesn’t scale anything; the scaling is handled by the monitor.
You can do almost the same thing yourself by rendering into 640x480 texture using a FBO then rendering the texture into the window. I say “almost”, because the monitor’s built-in scaling will probably be better than either GL_NEAREST or GL_LINEAR.