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

Author Topic: SFML Game Development [Parameter <name> was not found in shader]  (Read 2407 times)

0 Members and 1 Guest are viewing this topic.

FreezingEngine

  • Newbie
  • *
  • Posts: 1
    • View Profile
Hey Guys,
i have a problem with the shader-class of the book in the topic.
I receive only this output:



This is one shader:

uniform sampler2D       source;
uniform vec2            offsetFactor;

void main()
{
        vec2 textureCoordinates = gl_TexCoord[0].xy;
        vec4 color = vec4(0.0);
        color += texture2D(source, textureCoordinates - 4.0 * offsetFactor) * 0.0162162162;
        color += texture2D(source, textureCoordinates - 3.0 * offsetFactor) * 0.0540540541;
        color += texture2D(source, textureCoordinates - 2.0 * offsetFactor) * 0.1216216216;
        color += texture2D(source, textureCoordinates - offsetFactor) * 0.1945945946;
        color += texture2D(source, textureCoordinates) * 0.2270270270;
        color += texture2D(source, textureCoordinates + offsetFactor) * 0.1945945946;
        color += texture2D(source, textureCoordinates + 2.0 * offsetFactor) * 0.1216216216;
        color += texture2D(source, textureCoordinates + 3.0 * offsetFactor) * 0.0540540541;
        color += texture2D(source, textureCoordinates + 4.0 * offsetFactor) * 0.0162162162;
        gl_FragColor = color;
}

I have copied the code for the effect class out of the book.

Sorry for my bad english.

HavingPhun

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: SFML Game Development [Parameter <name> was not found in shader]
« Reply #1 on: June 18, 2014, 11:28:47 pm »
I have very little experience with shaders, though I doubt we will be able to know what is wrong unless you post some of your code and the vertex shader.

Rhimlock

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: SFML Game Development [Parameter <name> was not found in shader]
« Reply #2 on: June 23, 2014, 01:29:46 pm »
As far as I know. GLSL throws away unused variables.
So even if you have a variable in your shader-source, it might be missing at runtime, if it is not used.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: SFML Game Development [Parameter <name> was not found in shader]
« Reply #3 on: June 23, 2014, 01:59:47 pm »
Looking at diagonally, the code seems correct, are you sure the shader is successfully being compiled?