Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Parts of a RenderTexture + Weird shader/blendmode bug  (Read 1837 times)

0 Members and 1 Guest are viewing this topic.

Vovosunt

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Parts of a RenderTexture + Weird shader/blendmode bug
« 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:

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 :)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Parts of a RenderTexture + Weird shader/blendmode bug
« Reply #1 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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Vovosunt

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Parts of a RenderTexture + Weird shader/blendmode bug
« Reply #2 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