From 220c803e2a942e7140c65c2e733d22432656f008 Mon Sep 17 00:00:00 2001 From: azonalon Date: Sun, 9 Oct 2016 16:19:23 +0200 Subject: [PATCH] loadBMP_custom error fix If dataPos is longer then 54, the data read will include parts of the BMP header, so the file pointer needs to be updated. --- common/texture.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/texture.cpp b/common/texture.cpp index 0be7df4ac..371bcac91 100644 --- a/common/texture.cpp +++ b/common/texture.cpp @@ -51,6 +51,8 @@ GLuint loadBMP_custom(const char * imagepath){ if (imageSize==0) imageSize=width*height*3; // 3 : one byte for each Red, Green and Blue component if (dataPos==0) dataPos=54; // The BMP header is done that way + fseek(file, dataPos, SEEK_SET); + // Create a buffer data = new unsigned char [imageSize]; @@ -211,4 +213,4 @@ GLuint loadDDS(const char * imagepath){ return textureID; -} \ No newline at end of file +}