X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Frendertarget.cpp;h=c651e665fc46064ea2870e7034da0ab93ce081c5;hp=376af04877a4b324dd53518203b489c662b034c2;hb=af0ba2af0167247bcda74e76f3c83c0c0e89650a;hpb=b94d3423de1e61f46c22b421f4b293d2d094b89f diff --git a/source/rendertarget.cpp b/source/rendertarget.cpp index 376af048..c651e665 100644 --- a/source/rendertarget.cpp +++ b/source/rendertarget.cpp @@ -59,7 +59,7 @@ RenderTargetFormat RenderTargetFormat::operator,(PixelFormat f) const return result; } -int RenderTargetFormat::index(RenderOutput o) +int RenderTargetFormat::index(RenderOutput o) const { unsigned type = get_output_type(o); unsigned i = 0; @@ -133,7 +133,7 @@ void RenderTarget::init(unsigned w, unsigned h, unsigned s, const RenderTargetFo else { tgt.texture = new Texture2D; - tgt.texture->storage(pf, width, height); + tgt.texture->storage(pf, width, height, 1); tgt.texture->set_filter(NEAREST); tgt.texture->set_wrap(CLAMP_TO_EDGE); fbo.attach(att, *tgt.texture); @@ -155,7 +155,16 @@ RenderTarget::~RenderTarget() } } -const Texture2D &RenderTarget::get_target_texture(unsigned i) +void RenderTarget::set_texture_filter(TextureFilter filt) +{ + if(!samples) + { + for(vector::iterator i=buffers.begin(); i!=buffers.end(); ++i) + i->texture->set_filter(filt); + } +} + +const Texture2D &RenderTarget::get_target_texture(unsigned i) const { if(i>=buffers.size()) throw out_of_range("RenderTarget::get_target_texture"); @@ -165,7 +174,7 @@ const Texture2D &RenderTarget::get_target_texture(unsigned i) return *buffers[i].texture; } -const Texture2D &RenderTarget::get_target_texture(RenderOutput o) +const Texture2D &RenderTarget::get_target_texture(RenderOutput o) const { int index = format.index(o); if(index<0)