X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture2d.cpp;h=197e04df63830269f92a04ed4279636319ef4344;hb=b617c5d7b5283ad260a77f01e42e6170cabbc03d;hp=b8f2f26b7076320f78f5ef792dc69a9acd7e1b82;hpb=a5797c9babd17673285b3b15c7572c2d8fe1595c;p=libs%2Fgl.git diff --git a/source/texture2d.cpp b/source/texture2d.cpp index b8f2f26b..197e04df 100644 --- a/source/texture2d.cpp +++ b/source/texture2d.cpp @@ -17,21 +17,21 @@ Texture2D::Texture2D(): width(0), height(0) { - target=GL_TEXTURE_2D; + target = GL_TEXTURE_2D; bind(); } -void Texture2D::storage(PixelFormat fmt, sizei wd, sizei ht, int brd) +void Texture2D::storage(PixelFormat fmt, unsigned wd, unsigned ht, int brd) { if(width>0) throw InvalidState("Texture storage may only be specified once"); if(wd==0 || ht==0) throw InvalidParameterValue("Invalid texture dimensions"); - ifmt=fmt; - width=wd; - height=ht; - border=brd; + ifmt = fmt; + width = wd; + height = ht; + border = brd; } void Texture2D::image(int level, PixelFormat fmt, DataType type, const void *data) @@ -44,7 +44,7 @@ void Texture2D::image(int level, PixelFormat fmt, DataType type, const void *dat glTexImage2D(target, level, ifmt, width, height, border, fmt, type, data); } -void Texture2D::sub_image(int level, int x, int y, sizei wd, sizei ht, PixelFormat fmt, DataType type, const void *data) +void Texture2D::sub_image(int level, int x, int y, unsigned wd, unsigned ht, PixelFormat fmt, DataType type, const void *data) { if(width==0) throw InvalidState("Texture storage has not been specified"); @@ -64,9 +64,9 @@ void Texture2D::load_image(const string &fn) void Texture2D::image(const Graphics::Image &img) { - unsigned w=img.get_width(); - unsigned h=img.get_height(); - PixelFormat fmt=pixelformat_from_graphics(img.get_format()); + unsigned w = img.get_width(); + unsigned h = img.get_height(); + PixelFormat fmt = pixelformat_from_graphics(img.get_format()); if(width==0) storage(fmt, w, h, 0); else if(w!=width || h!=height) @@ -89,18 +89,18 @@ void Texture2D::Loader::image_data(const string &data) Graphics::Image img; img.load_memory(data.data(), data.size()); - static_cast(tex).image(img); + static_cast(obj).image(img); } void Texture2D::Loader::raw_data(const string &data) { - Texture2D &t2d=static_cast(tex);; + Texture2D &t2d = static_cast(obj); t2d.image(0, t2d.ifmt, UNSIGNED_BYTE, data.data()); } void Texture2D::Loader::storage(PixelFormat fmt, unsigned w, unsigned h, unsigned b) { - static_cast(tex).storage(fmt, w, h, b); + static_cast(obj).storage(fmt, w, h, b); } } // namespace GL