I have an array of data of the form:
union colour
{
unsigned int argb;
struct{
unsigned char a;
unsigned char r;
unsigned char g;
unsigned char b;
}bigendian;
struct{
unsigned char b;
unsigned char g;
unsigned char r;
unsigned char a;
}littleendian;
};
struct sprite
{
int w,h;//stores the dimensions
double dx,dy;//stores what to divide 1.0 by to get to the edge of the usable image
colour *data;//stores the image
unsigned int glTexture;//stores the opengl texture
};
And I need to find a way to populate it based solely on w,h and data. dx and dy may need a little more explanation, basically they allow for non 2^n size images by saying "divide your 1.0f by d(x/y) to get the edge of the real image, rather than the edge of the filler space. I think I need to use glTexImage2D but the API is somewhat vague as to how exactly to implement it. Any help would be greatly appreciated. Thanks.