Code loads one image but not another

I am currently working on a program that loads in a specific image type as a texture and was able to make it work. The only problem I am having now is that it won’t work on another image of the same type…
It is loading it but cutting a trianle shape of the image off of the left side and putting it on the right side of the image. I figure it might have to do with some sort of padding in the image that I am not taking into account, but am unsure how to go about fixing it. Any suggestions would be greatly appreciated.

thanks!

glPixelStore unpack_alignment is 4 bytes per default.
This will not work for odd sizes and GL_RGB types and is one of the most frequent mistakes apps have with small mipmaps of GL_RGB data (that is the 2x2 map will break).
Simply set glPixelStore(GL_UNPACK_ALIGNMENT, 1) if the data is tightly packed.

Ok thanks, let me try it out and see if that is where the problem is occuring. I will post back up and let you know if it works.
I am not sure if this makes a difference but it is a MrSID image, which is supported by LizardTech.

I didn’t work and I think that it might be because it is a MrSID file and it has to do with the LizardTech Library…
but still trying to figure it out. If anyone has any suggestions please post them up.

thanks!

Is it possible that you forgot to update the width and height to the new image size in your glTex(Sub)Image call? If I understand the problem correctly an effect like this can be the result of e.g. sending 640x480 image data with 512 for both width and height in your glTex(Sub)Image call.

No because I am using getWidth and getHeight to get the width and height of whatever image is being loaded. But thank you for the input

There are not enough informations to continue guessing here.
You said

I am currently working on a program that loads in a specific image type as a texture and was able to make it work. The only problem I am having now is that it won’t work on another image of the same type…
so obviously there is a difference between the two images. “MrSID image, supported by LizardTech” is meaningless here.
Simply drill down with your debugger into the code and find out all differences between the working and non-working image. If that’s not helping to find the root cause, come back with the details and the OpenGL code which handles the images.

It may be because the image is not a power of 2. Is there a way to convert the image to be a power of 2?

There are a few options:

  1. create a larger power of 2 texture, send the data using glTexSubImage into a rectangular area of the texture and adapt your texture coordinates accordingly when rendering.

  2. Use texture rectangle. They support non power of 2 textures but don’t support mimpaps.

  3. use gluBuild2DMipmaps