someone please help me with this

I have a texture class that currently loads .bmp, .tga, .dds, and jpg. Every thing works correctly with the exception that the bull**** jpeg texture lib reads the file backwards or something. Anyway my texture is upside down. I am not willing to change my texture coords just for jpegs nor should I have to. This is what I have done to remedy the situation but it is not working. Mabey someone else can help me.

I have got two unsgined char pointers:
ImageData and TempData;
after everthing loads TempData and ImageData are Identical this is the loop I am doing to reverse everything:

size = ImageWidth * ImageHeight * 4;
for(i = 0, j = size; i < size; i++, j–)
ImageData[i] = TempData[j];

That´s not a real error. JPEGs and BMPs store the image-data in a horizontally flipped. My lib also loads BMPs upside-down compared to all other formats. It´s annoying.

The only thing you can do, is to write your own loading function and flip the image around. Or if you use something like Devil, you can find out what kind of file it is and if it is a BMP (or JPEG) you not only load it, but additionally flip it around afterwards, before you upload it to OpenGL.

Jan.

yes i test to see if its a jpg and i am using the Independent JPEG Groups lib. I realize its not an error but i was just wondering if I could use that lib to load it in and then manipulate the data with that loop i gave

here is some code that should reverse the scanlines given two arrays, imageData (the destination) and tempData (the initial flipped image):

int rowSize = width * 4;
int imageSize = rowSize * height;
for (int i=0; i < height; ++i)
byteCopy(imageData + imageSize - (i+1)*(rowSize), tempData + (i * rowSize), rowSize);

That code looks good but Im not familiar with byteCopy. Is that a C function? or do you mean memcpy?