View Full Version : bitmap as a background is crapped up!
07-18-2004, 01:56 AM
Hello! I want to place my picture as a background image (800*600), but it is really blured and it is not drawn completely, only a part of it.
glOrtho(0, Width, 0, Height, -1, 1);
glVertex3i(0, 0, 0);
glVertex3i(800, 0, 0);
glVertex3i(800, 600, 0);
glVertex3i(0, 600, 0);
07-18-2004, 09:42 AM
is Width and Height in that ortho call actually 800 and 600 ?
that its blurred is probably the texture filter
e.g this should make it non flitered.
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
07-18-2004, 12:31 PM
make sure for you glVertex3i have the variables width and height, because what if the user was running in 640, 480? the glTexParameteri functions should fix that also.
07-21-2004, 11:25 AM
thanks a lot!
as far as I understand there cn be problems on some systems with non-standard texture sizes? Should I place my image into a 1024*1024 texture and change texture coords?
07-21-2004, 02:05 PM
You can also use the NV_TEXTURE_RECTANGLE extension if you want to use non power of 2 texture sizes. This extension does not allow mipmapping so results won't be very good if you draw in a small window.
I believe that the most recent generation of graphics cards support the ARB_texture_non_power_of_two extension, which allows you to use npotd textures without further limitations.
If you want to run your program on older cards, storing the texture in 1024 by 1024 texture and adapting the texcoords, like you said, is indeed the way to go.
Also, don't forget to call glLoadIdentity() before your glOrtho() call, because the supplied matrix is multiplied with the current projection matrix.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.