SFML community forums

Help => Graphics => Topic started by: Vovosunt on April 14, 2012, 02:26:43 pm

Title: Parts of a RenderTexture + Weird shader/blendmode bug
Post by: Vovosunt on April 14, 2012, 02:26:43 pm
1) I need to reuse parts of a single renderTexture as Textures, so I was wondering how can you do it in SFML?
(or do I actually have to code it in openGL? getTexture(sf::Rect) would be nice :P)

2) I also found a weird bug... or maybe it's just my GPU
Anyway, I'm basically multiplying the renderTexture over itself and shifting it every time upwards by 1, 2, 4, 8 and so on pixels. For some reason the renderTexture starts "banding" and multiplying itself much further and some weird artifacts appear:
(http://img214.imageshack.us/img214/8567/shaderbug.jpg)
I've tried both shaders and just using BlendMultiply, but the effect perseveres.
But it might be just my GPU... laptop Intel GPUs are shit.

But if anyone knows a better and faster way to "bleed" or smear pixels, I would really appreciate if you'd tell me about it :)
Title: Re: Parts of a RenderTexture + Weird shader/blendmode bug
Post by: Nexus on April 14, 2012, 02:39:23 pm
To get only a part of a sf::RenderTexture, you probably need to go the long way via sf::Image.
texture.loadFromImage(renderTexture.getTexture().copyToImage(), rect);

But can't you just apply the texture rect when you draw something? Then you don't have to create a new texture or to copy masses of pixels around.
Title: Re: Parts of a RenderTexture + Weird shader/blendmode bug
Post by: Vovosunt on April 15, 2012, 02:42:25 pm
To get only a part of a sf::RenderTexture, you probably need to go the long way via sf::Image.
texture.loadFromImage(renderTexture.getTexture().copyToImage(), rect);

But can't you just apply the texture rect when you draw something? Then you don't have to create a new texture or to copy masses of pixels around.

Actually, I think I can, since I'm using shaders anyway :D
Thanks!

Now if I only could make this work just a bit faster, damn it XD