This is a 1024 x 512 jpg.
The size variable returns 84793.
One thing that I don't understand is the 84793 as the size of the file when 1024 * 512 = 524288.
I would think this would be * 3 since 3 channels per pixel.
The count variable is returning 65.
Right now I'm getting a access violation reading location on this line when I'm setting OpenGL texture parameters:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texWidth, texHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, texPtr);
Where texWidth and texHeight where the width and height from below.
Here's what I have currently:
int width = 1024;
int height = 512;
long size = 0;
GLubyte * data;
FILE * file;
char name[100];
int count;
int test;
strcpy(name, filename);
// open texture data
file = fopen( name, "r" );
if ( file == NULL )
{
fputs ("File error",stderr);
exit (1);
}
fseek (file , 0 , SEEK_END);
size = ftell( file );
rewind(file);
// allocate buffer
data = (unsigned char *)malloc( sizeof(char)*size );
count = (int) fread (data,sizeof(unsigned char) ,size,file);
fclose( file );
// allocate a texture name
glGenTextures( 1, &dayGLTexture );
initTexture(dayGLTexture, width, height, data);