As the title suggests, whenever I try using a shader with the window draw, I get a black screen.
This is the draw function I'm using:
private void Draw
(){ window
.Clear(); renderTexture
.Clear(); renderTexture
.Draw(borderSprite
); EntityManager
.Draw(renderTexture
); renderTexture
.Display(); renderTextureSprite
.Texture = renderTexture
.Texture; RenderStates states
= new RenderStates
(); states
.Shader = myShader
; window
.Draw(renderTextureSprite, states
); window
.Display();} Normal, if I were to just draw the texture without any states, it works exactly like intended:
window.Draw(renderTextureSprite);
I tried setting up an example shader from the SFML.NET 2.2 examples. I chose the pixelate shader. Here's how I set up the shader:
myShader
= new Shader
(null,
"Assets/Shaders/pixelate.frag");myShader
.SetParameter("texture", Shader
.CurrentTexture);myShader
.SetParameter("pixel_threshold",
200);When I run the EXE of the example (shader.exe), the shader works as intended, but when I try to use it on my game: black screen. I am pretty sure I copied all the shader code exactly like the example code.
My end goal is to create a bloom effect like in this thread(
https://en.sfml-dev.org/forums/index.php?topic=7827.0) to make it look like Geometry Wars (
)
I am using SFML.NET 2.2 with VS2013.