Cory Klein
03-28-2009, 12:53 PM
I have some bitmaps that I want to display exactly on the screen, mapping pixels in the bitmap exactly to pixels on the screen, no scaling, rotation, filtering, etc. This is partly because I want a clean look (exact reproduction of image) and part because of render speed. I am finding this difficult, because of a few problems. First, is the following part in my code:
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
It's hard to get the size of a texture to be the exact right size on this scale instead of a pixel scale. If my image is 32x32 pixels, finding coordinates of the corners for the sprite vertices is difficult.
Since I know what my screen resolution will always be, can I solve that problem by just setting those to the actual screen resolution?
Second, is this:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
I have to have some sort of texture filter in order for the image to show at all right now, but running the bitmap through a filter defeats the whole purpose of not changing the image, right?
I think I should be able to do this because I know that I will never be resizing or rotating the images. Do I have to avoid the whole sprite vertex idea all together to do this?
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
It's hard to get the size of a texture to be the exact right size on this scale instead of a pixel scale. If my image is 32x32 pixels, finding coordinates of the corners for the sprite vertices is difficult.
Since I know what my screen resolution will always be, can I solve that problem by just setting those to the actual screen resolution?
Second, is this:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
I have to have some sort of texture filter in order for the image to show at all right now, but running the bitmap through a filter defeats the whole purpose of not changing the image, right?
I think I should be able to do this because I know that I will never be resizing or rotating the images. Do I have to avoid the whole sprite vertex idea all together to do this?