(Apologies if this issue has been brought up in a separate thread. If it has, I've been unable to find it.)
I am using the .NET bindings for SFML 1.6. I have been happily drawing sprites and so forth to the screen using the RenderWindow. I then took a look at the PostFx tutorial.
I copied the GSGL code from the tutorial, and have it in a file whose path is "fx/grey.sfx":
texture framebuffer
vec3 color
effect
{
// Get the value of the current screen pixel
vec4 pixel = framebuffer(_in);
// Compute its gray level
float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11;
// Finally write the output pixel using 50% of the source pixel and 50% of its colored version
_out = vec4(gray * color, 1.0) * 0.5 + pixel * 0.5;
}
I am able to load this file in as a string using a StreamReader object, so the program definitely has access to it.
However, when I try and construct a PostFx object, passing in that path as the parameter, it throws a LoadingFailedException. This happens with other sfx files I have tried as well. The message in the exception is "Failed to load post-fx from file fx/grey.sfx". Looking at the source code for PostFx, as far as I can tell the .NET bindings always throw away any information the C code might return on why the thing has failed to load and just throw this exception.
The tutorial says that errors during compilation of the fragment shader code will appear on the standard error out. As far as I can work out, this is not the case under C#.NET. If there is a way of getting at that kind of output, please let me know.
Otherwise, any other ideas what I'm doing wrong?
using SFML.Graphics;
namespace SFMLTest
{
class TestMain
{
static void Main()
{
PostFx fx = null;
if (PostFx.CanUsePostFX)
{
string filename = "fx/grey.sfx";
fx = new PostFx(filename);
}
}
}
}