Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: A Problem with PostFX and GLSL Functions (v1.6)  (Read 2594 times)

0 Members and 1 Guest are viewing this topic.

Strobe

  • Newbie
  • *
  • Posts: 15
    • View Profile
A Problem with PostFX and GLSL Functions (v1.6)
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
A Problem with PostFX and GLSL Functions (v1.6)
« Reply #1 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!
Laurent Gomila - SFML developer

Strobe

  • Newbie
  • *
  • Posts: 15
    • View Profile
A Problem with PostFX and GLSL Functions (v1.6)
« Reply #2 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 :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
A Problem with PostFX and GLSL Functions (v1.6)
« Reply #3 on: August 19, 2011, 07:09:28 pm »
Yeah... you had the "Disable BBCode" box checked ;)
Laurent Gomila - SFML developer

Strobe

  • Newbie
  • *
  • Posts: 15
    • View Profile
A Problem with PostFX and GLSL Functions (v1.6)
« Reply #4 on: August 19, 2011, 07:27:17 pm »
Gah! Thank you  :oops:

Strobe

  • Newbie
  • *
  • Posts: 15
    • View Profile
A Problem with PostFX and GLSL Functions (v1.6)
« Reply #5 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!

 

anything