unsigned int pixelsPerRow = (bytesPerPixel * texture.width);
GLubyte *temp = new GLubyte[pixelsPerRow];
GLubyte *start = texture.pImageData;
GLubyte *end = texture.pImageData+(pixelsPerRow * (texture.height - 1));
while(start < end)
{
memcpy(temp, start, pixelsPerRow);
memcpy(start, end, pixelsPerRow);
memcpy(end, temp, pixelsPerRow);
start += pixelsPerRow;
end -= pixelsPerRow;
}
delete [] temp; |