greetings, I am usiing Nate Miller''s tga file loading code. When I try to compile it I keep getting type casting errors.
i.e.''='': cannot convert from ''void *'' to ''unsigned char*''
//reads in rgba data for a 32bit image
unsigned char *getRGBA (FILE *s, int size)
unsigned char *rgba;
unsigned char temp;
//tga is stored in bgra, make it rgba
if (bread != size * 4)
for (i = 0; i < size * 4; i+=4)
temp = rgba;
rgba[i] = rgba[1 + 2];
rgba[1 + 2] = temp;
texFormat = GL_RGBA;
When i rewrite it to rgba =(unsigned char *) malloc(size * 4); the error goes away. Although, malloc uses a void * and a void pointer is able to point to any type of object. Why do I get the error? Or maybe I just copied the code down wrong. Thanks in advance.
"There are ones that say they can and there are those who actually do."
"...u can not learn programming in a class, you have to learn it on your own."