Jump to content
  • Advertisement
Sign in to follow this  
parroteye

Failing to load correctly some images with stb_image

This topic is 506 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!

 

Up to now I have only been using dds, I am now trying to load some jpg and png textures to test something, but I have had mixed luck with stb 

 

All I do to load is 

stbi_load(path, &w, &h, &c, STBI_rgb_alpha); 

Now some textures load ok,

Nsttahp.png

 

some load with a strange stripey pattern

bKWRXo2.png

 

Stripey pattern that is not visible in the source image.

 

I tried STBI_rgb for the one that loaded strangely, but the result is even more wrong in most cases, like I would expect actually... 

 

What am I doing wrong? The texture resource is created in all cases with DXGI_FORMAT_R8G8B8A8_UNORM

 

thanks

 

Jacques

 

Share this post


Link to post
Share on other sites
Advertisement

stb_image is documented to not have complete support for all JPG and PNG formats: have a look at the top of the header file for notes on this.

However I suspect that is isn't your problem (the formats it doesn't handle are unlikely to be met in common usage) but rather that stb_image is loading the textures correctly and that your problem is actually happening during the transfer of the image data to Direct3D.  You'll need to talk a little about how you're doing that before I can say more.

Share this post


Link to post
Share on other sites

stb_image is documented to not have complete support for all JPG and PNG formats: have a look at the top of the header file for notes on this.

However I suspect that is isn't your problem (the formats it doesn't handle are unlikely to be met in common usage) but rather that stb_image is loading the textures correctly and that your problem is actually happening during the transfer of the image data to Direct3D.  You'll need to talk a little about how you're doing that before I can say more.

 

It was indeed that! After posting I googled a bit, to find that comp is not the number of components of the output data like I thought it was! 

Share this post


Link to post
Share on other sites

if you think you have l0oaded texture properly then you need to check your rendering code perspective projection etc/ and see if you are even drawing it properly

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!