diff --git a/api/gutil.cpp b/api/gutil.cpp index 2295fae35a..039d8d6173 100755 --- a/api/gutil.cpp +++ b/api/gutil.cpp @@ -422,10 +422,11 @@ int read_ppm_file(char* name, int& w, int& h, unsigned char** arrayp) { unsigned int texture_id; -void init_texture(char* filename) { +int init_texture(char* filename) { unsigned char* pixels; - int width, height; - read_ppm_file(filename, width, height, &pixels); + int width, height, retVal; + retVal = read_ppm_file(filename, width, height, &pixels); + if (retVal) return retVal; glGenTextures(1, &texture_id); glBindTexture(GL_TEXTURE_2D, texture_id); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -443,6 +444,7 @@ void init_texture(char* filename) { GL_UNSIGNED_BYTE, pixels ); + return 0; } struct Vertex { diff --git a/api/gutil.h b/api/gutil.h index cb30af5732..c8937d33de 100755 --- a/api/gutil.h +++ b/api/gutil.h @@ -87,6 +87,6 @@ public: // extern int read_ppm(char* name, int& w, int& h, unsigned char** arrayp); -extern void init_texture(char* filename); +extern int init_texture(char* filename); extern void draw_texture(float* pos, float* size);