mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:00:41 +02:00
Removed width & height args from load_png_as_texture()
This commit is contained in:
parent
2d6a2922a7
commit
255f9e73d3
3 changed files with 8 additions and 5 deletions
6
main.cpp
6
main.cpp
|
@ -201,8 +201,8 @@ double elapsedTime;
|
||||||
// (ensure "Copy file" is checked
|
// (ensure "Copy file" is checked
|
||||||
// 2. Add to the "Copy files" build phase in the project
|
// 2. Add to the "Copy files" build phase in the project
|
||||||
char texture_filename[] = "grayson-particle.png";
|
char texture_filename[] = "grayson-particle.png";
|
||||||
unsigned int texture_width = 256;
|
//unsigned int texture_width = 256;
|
||||||
unsigned int texture_height = 256;
|
//unsigned int texture_height = 256;
|
||||||
|
|
||||||
float particle_attenuation_quadratic[] = { 0.0f, 0.0f, 2.0f }; // larger Z = smaller particles
|
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
|
but texture origin is at upper left
|
||||||
=> it has to be mirrored */
|
=> 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);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glNormal3f(0.0, 0.0, 1.0);
|
glNormal3f(0.0, 0.0, 1.0);
|
||||||
|
|
|
@ -20,9 +20,12 @@
|
||||||
#define TEXTURE_LOAD_ERROR 0
|
#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<unsigned char> image;
|
std::vector<unsigned char> 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);
|
unsigned error = lodepng::decode(image, width, height, filename);
|
||||||
if (error) {
|
if (error) {
|
||||||
return (int) error;
|
return (int) error;
|
||||||
|
|
|
@ -16,6 +16,6 @@
|
||||||
#include <GL/glut.h>
|
#include <GL/glut.h>
|
||||||
#endif
|
#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__) */
|
#endif /* defined(__interface__texture__) */
|
||||||
|
|
Loading…
Reference in a new issue