SFML community forums

Help => Graphics => Topic started by: Strobe on August 19, 2011, 02:50:55 am

Title: A Problem with PostFX and GLSL Functions (v1.6)
Post by: Strobe on August 19, 2011, 02:50:55 am
Hi,

I'm trying to implement a simple function in my GLSL shader program, but am met with errors. The version of SFML I am using is 1.6, with Code::Blocks 10.05 for Windows (MinGW).

Here's the offending code:

Code: [Select]
// shader.sfx
texture Img1

float foo(in float fubar)
{
return(fubar);
}

effect
{
_out = Img1(_in);
}


and here are the errors:

Quote
Post-effect error : invalid declaration (should be "[type][name]")
> {
Failed to compile post-effect :
(0) : error C0000: syntax error, unexpected $end at token "<EOF>"
(0) : error C0501: type name expected at token "<null atom>"


I suspect SFML isn't properly parsing the shader source. One reason for my belief is that it won't accept the ';' terminator at the end of variable declarations. Another is how this will work:

Code: [Select]
effect
{
_out = Img1(_in);
}


but this will not:

Code: [Select]
effect {
_out = Img1(_in);
}


I've tried not adding ';' at the end of the return line, and also removing 'in,' among other things.

Should I be using SFML 2.0?

thx,

~Strobe
Title: A Problem with PostFX and GLSL Functions (v1.6)
Post by: Laurent on August 19, 2011, 11:43:51 am
Quote
I suspect SFML isn't properly parsing the shader source

I think so.

Quote
Should I be using SFML 2.0?

Definitely!
Title: A Problem with PostFX and GLSL Functions (v1.6)
Post by: Strobe on August 19, 2011, 06:55:58 pm
Alright, I'll give it a try.

BTW, I tried wrapping code and quote tags around text in my post, but they didn't do anything. But now, there they are. Thanks, if that was your doing :)
Title: A Problem with PostFX and GLSL Functions (v1.6)
Post by: Laurent on August 19, 2011, 07:09:28 pm
Yeah... you had the "Disable BBCode" box checked ;)
Title: A Problem with PostFX and GLSL Functions (v1.6)
Post by: Strobe on August 19, 2011, 07:27:17 pm
Gah! Thank you  :oops:
Title: A Problem with PostFX and GLSL Functions (v1.6)
Post by: Strobe on August 20, 2011, 12:32:00 am
Yes! Got 2.0 compiled (which was a surprisingly painless process), and everything is as it should be. Had a difficult patch while trying to compile a program, but I played Tower of Hanoi with the linked libraries until I found the right order.

GLSL shaders now seem to be working as they should 8) Thanks again for everything, Laurent!