Jump to content
  • Advertisement
Sign in to follow this  
Kumado

Linux - SDL - png files

This topic is 4170 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!