I was trying to implement jpg loader in my app, but everytime I load file, it has visible artifacts - white horizontal lines. When I load file that’s given with gametutorials jpeg loader, everything is fine. Where is the problem, are those libs old or what?
The problem can be hard to find but here are several ways.Are you using our own way of loading JPEG files.Try first the tested ways and then see what’s wrong with your code.The JPEGs libraries are not old,you just do something wrong.
Same with compiled exe’s from gametutorials You can check that yourself, just download textut3 & use your own textures instead given ones.
Are the jpegs you use in the power of two?
Like: 256x256 or 512x512?
Yeap, 100000%. Have someone checked those examples? Image.jpg loads well as far as I don’t touch it, but if I resave it with Paint/PainterClassic/W-XP Picture viewer everything goes wrong
Its a requirement of OpenGL that textures are in a power of two.
There are a couple of ways to use a ‘non power of two’ texture in OpenGL.
Here are two examples (there is a third which includes mipmapping but I am not sure if you are ready for that yet, no offense)
1.) Stretch the picture (dont care about the aspect ratio) to the next biggest power of two size. When you texture that to an rectangle that has the same aspect ratio then your initial pic it will be fine (except that the filtering may not as got as on a none stretched image).
2.) create a power of two size texture bigger than the image and place you image inside that (dont forget to adjust the texture coordinates).
Depending on what you want to do 1.) or 2.) may be more suited.
Hi, the wheel is done!. You can use the “FreeImage” lib for loading jpg, tga, tiff, pnb, bmp…as texture for OpenGL. It’s very ease.
Yeap, I think I’m not redy for mipmapping yet, coz I’m using GL_GENERATE_MIPMAP_SGIS on hw where possible & simple mipmapping where not
OK, enough The problem is in fact that I use those textures to create world maze + outdoor env, w reflections (stencil) & CG for lighting stuff. And everything was fine while I was using BMP’s, they all are 256x256@600dpi & 24bit, Except for skybox where I have 512x512 textures. But when I resave those images to JPG & load through my JPG routine OR gametutorials JPEG loading routine, strange artifacts appear
Unfortunately, I have some reasons not not to use any kind of libs
[This message has been edited by M/\dm/
Seems that problem arises only with files saved on W-XP Pro