bloboland

diff src/texture.cc @ 5:2f4406cc341e

meh
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 19 Dec 2012 02:37:20 +0200
parents 9021a906c5d3
children
line diff
     1.1 --- a/src/texture.cc	Tue Dec 18 06:13:09 2012 +0200
     1.2 +++ b/src/texture.cc	Wed Dec 19 02:37:20 2012 +0200
     1.3 @@ -25,6 +25,7 @@
     1.4  Texture::Texture()
     1.5  {
     1.6  	type = 0;
     1.7 +	intfmt = GL_RGBA;
     1.8  
     1.9  	size[0] = size[1] = size[2] = 0;
    1.10  
    1.11 @@ -38,6 +39,11 @@
    1.12  	}
    1.13  }
    1.14  
    1.15 +void Texture::set_pixel_format(unsigned int fmt)
    1.16 +{
    1.17 +	intfmt = fmt;
    1.18 +}
    1.19 +
    1.20  void Texture::set_filtering(unsigned int min_filter, unsigned int mag_filter)
    1.21  {
    1.22  	if(mag_filter == 0) {
    1.23 @@ -74,7 +80,7 @@
    1.24  void Texture1D::create(int sz, float *data)
    1.25  {
    1.26  	glBindTexture(type, tex);
    1.27 -	glTexImage1D(type, 0, GL_RGBA, sz, 0, GL_RGBA, GL_FLOAT, data);
    1.28 +	glTexImage1D(type, 0, intfmt, sz, 0, GL_RGBA, GL_FLOAT, data);
    1.29  
    1.30  	size[0] = sz;
    1.31  }
    1.32 @@ -97,7 +103,7 @@
    1.33  void Texture2D::create(int xsz, int ysz, float *data)
    1.34  {
    1.35  	glBindTexture(type, tex);
    1.36 -	glTexImage2D(type, 0, GL_RGBA, xsz, ysz, 0, GL_RGBA, GL_FLOAT, data);
    1.37 +	glTexImage2D(type, 0, intfmt, xsz, ysz, 0, GL_RGBA, GL_FLOAT, data);
    1.38  
    1.39  	size[0] = xsz;
    1.40  	size[1] = ysz;
    1.41 @@ -124,7 +130,7 @@
    1.42  void Texture3D::create(int xsz, int ysz, int zsz, float *data)
    1.43  {
    1.44  	glBindTexture(type, tex);
    1.45 -	glTexImage3D(type, 0, GL_RGBA, xsz, ysz, zsz, 0, GL_RGBA, GL_FLOAT, data);
    1.46 +	glTexImage3D(type, 0, intfmt, xsz, ysz, zsz, 0, GL_RGBA, GL_FLOAT, data);
    1.47  
    1.48  	size[0] = xsz;
    1.49  	size[1] = ysz;