FYI: gluScaleImage is (sometimes) GL_REPEAT
This is a small FYI for gluScaleImage users. It took me a long time to find this feature, and hopefully you'll be able to use it to your advantage.
If you are working on OpenGL, you probably know that you usually need 2^n texture sizes, usually from 64×64 and usually to 2048×2048 (modern cards). Everything else must be scaled.
In all the manuals, they suggest to use the gluScaleImage in order to rescale the image from a format to another, like if you got a 35×53 texture, you probably want a 64×64. In there, gluScaleImage is your friend… usually. First, you must properly initialize your OpenGL environment, and properly set up its flags. Usually this is no big deal. But then, the gluScaleImage algorithm does not set up any guidelines on how the texturing is done internally, all they say is "linear interpolation" and that's what you will expect. Any other parameter will be implementation-dependent.
This includes the wrapping mode. Since there is no way to indicate how you want to wrap the image, it uses what the implementation deems as "best bet", which is the OpenGL 1.0 default mode: GL_REPEAT. So: pixels will warp from one side to the other during the interpolation. It's a very good bet for most textures, as most are meant to be repeated, but then, for HUDs, user-generated pictures and other textures that you will set to GL_CLAMP, GL_CLAMP_TO_EDGE or GL_CLAMP_TO_BORDER, it will not be what you expect. You will see stray pixels on the other side.
The answer to that is : devise your own algorithm. Sorry kiddo but that's your turf now. If you want to properly control how the image is scaled, create your own version of gluScaleImage. That way, your application will be happy and you will not get strange bugs.
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=9202
