I'm loading a texture image:
//glGenTextures... glBindTexture...
BYTE* image = (BYTE*) malloc(256 * 256 * 3);
FILE* imageFile;
errno_t err = fopen_s(&imageFile, fileName, "rb");
if (err != 0){
perror("Error loading file");
return false;
}
fread(image, 256 * 256 * 3, 1, imageFile);
fclose(imageFile);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 256, 256, GL_RGB, GL_UNSIGNED_BYTE, image);
I am building it in VS2013, and it always works when I execute it in VS. However when I copy out the executable and run it there, it sometimes works which is strange. I have completely no idea why it is happening.
The texture is 256x256 in .data format (raw data).