🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Linux - SDL - png files

Started by
5 comments, last by Kumado 17 years, 2 months ago
Hi, I recently switched over to Linux programming. I am having trouble with loading png files. I used NEHE's tutorial # 8, added the SDL_Image files needed ( header and lib ) and fixed an image to use instead of the bit map. What I get is an image with red, green and blue stripes through it in what seems to be a regular pattern from top to bottom and the image is there but it looks like 5 times and it seems to shift down the face of the cube a few pixels, evenly spaced, at a time. I am in Suse 10.2 I compile with g++ The image is 128 by 128 It runs just fine with the bit map and it runs ... with the png except the image is off. Thanks for any help! Kumado
Advertisement
Hi,

be carefull that BMP file are not equal (in memory data storage point of view) to other format. Image are stored bottom-top/right-left (like mirrored) and palette data is BGR not RGB. So if you have use same code for loading, you'll be in trouble.

Regards.
Thanks for the reply!

Yes, I did know that the image was RGB instead of BGR.
When I first did this in windows, I used the exact routine from the tutorial but chnged the load_bmp for img_load and made the changes to the bgr > rgb and it worked just fine.
I have the image there now, sort of, just striped and skewed. I am not sure what to look for ... yet.
Any other thoughts anyone?

Thanks

Kumado
euh... are you sure your image data are correct ?
I try lesson 6 with converted texture to png (with imagemagick), apply previous changes + change drawing face order, gltextcoord call, (from anti-clockwise to opposite). No trouble.

Have you check error for texture sub calls (glTexImage2D and glTexParameter), perhaps your texture size is not power of 2 (texture should be 2^x * 2^x size). And also, and before, for image loading ?
I had actually copied and pasted the code from my Dev C project in windows to my .cpp file for Linux. It worked fine in windows so I thought it'd be the same in Linux, as far as code goes.
The image is for sure 128 by 128 pixels.

I am going to look at simply replacing the load in the tutorial and make the change from BGR to RGB and try again. Just kinda hard to figgure what is wrong.

Thanks for helping.

Kumado
paste your image/texture loading code.
This space for rent.
well hmmmmm,

More to figgure out as I go it seems.

I thought I had a simple png image but it had an alpha portion to it as well. I got one of my old textures from my windows project and it loaded just fine.

Somewhere in here I will have to figure out how to work Gimp a little better. :(

Thanks much for the posts.

Kumado

This topic is closed to new replies.

Advertisement