X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexture1d.cpp;h=39782efd8124d357e5bacdb88278309ea578d2b3;hp=ed7d8f6e2b877fd4f660d71dbdc72874ef3de34b;hb=HEAD;hpb=194f960f91041ebee44e2745627d5e480e893d82 diff --git a/source/texture1d.cpp b/source/texture1d.cpp deleted file mode 100644 index ed7d8f6e..00000000 --- a/source/texture1d.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include -#include -#include "bindable.h" -#include "error.h" -#include "texture1d.h" - -using namespace std; - -namespace Msp { -namespace GL { - -Texture1D::Texture1D(): - Texture(GL_TEXTURE_1D), - ifmt(RGB), - width(0), - allocated(0) -{ - static Require _req(MSP_texture1D); -} - -void Texture1D::storage(PixelFormat fmt, unsigned wd) -{ - if(width>0) - throw invalid_operation("Texture1D::storage"); - if(wd==0) - throw invalid_argument("Texture1D::storage"); - - if(MSP_sized_internal_formats) - fmt = get_sized_pixelformat(fmt); - require_pixelformat(fmt); - - ifmt = fmt; - width = wd; -} - -void Texture1D::allocate(unsigned level) -{ - if(allocated&(1<>=1, ++n) ; - return n; -} - -unsigned Texture1D::get_level_size(unsigned level) const -{ - return width>>level; -} - -UInt64 Texture1D::get_data_size() const -{ - return id ? width*get_pixel_size(ifmt) : 0; -} - - -Texture1D::Loader::Loader(Texture1D &t): - DataFile::DerivedObjectLoader(t) -{ - init(); -} - -Texture1D::Loader::Loader(Texture1D &t, Collection &c): - DataFile::DerivedObjectLoader(t, c) -{ - init(); -} - -void Texture1D::Loader::init() -{ - add("raw_data", &Loader::raw_data); - add("storage", &Loader::storage); -} - -void Texture1D::Loader::raw_data(const string &data) -{ - obj.image(0, get_base_pixelformat(obj.ifmt), UNSIGNED_BYTE, data.data()); -} - -void Texture1D::Loader::storage(PixelFormat fmt, unsigned w) -{ - if(srgb) - fmt = get_srgb_pixelformat(fmt); - obj.storage(fmt, w); -} - -} // namespace GL -} // namespace Msp