From 255f9e73d3ab2c1a53fa59c1d9cb77402fd2e2a7 Mon Sep 17 00:00:00 2001 From: Yoz Grahame Date: Wed, 7 Nov 2012 12:48:51 -0800 Subject: [PATCH] Removed width & height args from load_png_as_texture() --- main.cpp | 6 +++--- texture.cpp | 5 ++++- texture.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 436f216fe8..88f2feddf0 100644 --- a/main.cpp +++ b/main.cpp @@ -201,8 +201,8 @@ double elapsedTime; // (ensure "Copy file" is checked // 2. Add to the "Copy files" build phase in the project char texture_filename[] = "grayson-particle.png"; -unsigned int texture_width = 256; -unsigned int texture_height = 256; +//unsigned int texture_width = 256; +//unsigned int texture_height = 256; float particle_attenuation_quadratic[] = { 0.0f, 0.0f, 2.0f }; // larger Z = smaller particles @@ -611,7 +611,7 @@ void display(void) but texture origin is at upper left => it has to be mirrored */ - int error = load_png_as_texture(texture_filename, texture_width, texture_height); + int error = load_png_as_texture(texture_filename); glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); glNormal3f(0.0, 0.0, 1.0); diff --git a/texture.cpp b/texture.cpp index 01db2bade3..6500b28e3f 100644 --- a/texture.cpp +++ b/texture.cpp @@ -20,9 +20,12 @@ #define TEXTURE_LOAD_ERROR 0 -int load_png_as_texture(char* filename, unsigned int width, unsigned int height) +int load_png_as_texture(char* filename) { std::vector image; + // width and height will be read from the file at the start + // and loaded into these vars + unsigned int width = 1, height = 1; unsigned error = lodepng::decode(image, width, height, filename); if (error) { return (int) error; diff --git a/texture.h b/texture.h index 200c1fce0d..b356db5b6f 100644 --- a/texture.h +++ b/texture.h @@ -16,6 +16,6 @@ #include #endif -int load_png_as_texture(char* filename, unsigned int width, unsigned int height); +int load_png_as_texture(char* filename); #endif /* defined(__interface__texture__) */