SFML community forums

Help => Graphics => Topic started by: dydya-stepa on November 30, 2011, 04:00:04 pm

Title: Texel size when rendering a sprite with a shader
Post by: dydya-stepa on November 30, 2011, 04:00:04 pm
i'm rendering a sprite into window like this:

window.Draw(sprite, shader)

My window's size is 800*600 but my sprite's size is 1024*1024. I'm rendering it with some offset so only portion is shown. The shader (blur) needs texel size which is 1 / width for horizontal and 1 / height per vertical.

So the question is what the width and height should be equal to?
Title: Texel size when rendering a sprite with a shader
Post by: Laurent on November 30, 2011, 04:10:05 pm
It must be equal to the sprite's texture width/height.

Code: [Select]
shader.SetParameter("width", sprite.GetTexture()->GetWidth());
shader.SetParameter("height", sprite.GetTexture()->GetHeight());