Hi, as always, thanks for your answers
Short answer, yes.
But thanks to your answer, I realized something, I need call for a display after pass the shader.
Originally my loop was:
- Draw sprite from game to a rendertexture named oGame.gameWindow.
- oGame.gameWindow.Display();
- Convert de renderTexture to a sprite named sprGameWindow.
- Scale and center the sprite sprGameWindow.
- Pass the new sprite and the shader to windowsrender:
window.Draw(sprGameWindow, new RenderStates(fragShader));
From what I understand, gl_FragCoord is returning the coordinate of the object that calls draw() (windowrender in this case) and not the object that I pass as a parameter (sprGameWindow).
With that in mind, I changed my loop, adding a temporary renderTexture that calls the draw function and now works it as intended.
New loop:
- Draw sprite from game to a rendertexture named oGame.gameWindow.
- oGame.gameWindow.Display();
- Convert de renderTexture to a sprite named sprGameWindow.
- Scale the sprite sprGameWindow.
- Pass the sprite sprGameWindow and the shader to tempRenderTexture:
tempRenderTexture.Draw(sprGameWindow, new RenderStates(fragShader));
tempRenderTexture.Display().
- Convert de temprenderTexture to a new sprite.
- Center the new sprite.
window.Draw(tempRenderTexture);
Thank you very much eXpl0it3r