}
else
{
- if(unsized!=RGB && unsized!=RGBA)
+ if(unsized!=RED && unsized!=RG && unsized!=RGB && unsized!=RGBA)
throw invalid_argument("RenderTargetformat::operator,");
if(size>3)
--size;
PixelFormat get_output_pixelformat(unsigned char o)
{
- unsigned ncomp = (o&3)+1;
unsigned size = ((o>>2)&3);
PixelFormat base;
if(get_output_type(o)>=get_output_type(RENDER_DEPTH))
}
else
{
- base = (ncomp==4 ? RGBA : RGB);
+ static PixelFormat base_formats[4] = { RED, RG, RGB, RGBA };
+ base = base_formats[o&3];
if(size==3)
++size;
}
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);
}
}
+void RenderTarget::set_texture_filter(TextureFilter filt)
+{
+ if(!samples)
+ {
+ for(vector<TargetBuffer>::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())