SFML community forums

Help => General => Topic started by: Bloob on August 13, 2014, 06:04:30 pm

Title: Outdated openGL?
Post by: Bloob on August 13, 2014, 06:04:30 pm
Today I tried to test my game on my friends computer but we ran into a few errors.

his gfx card : gtx 650 ti boost

(https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/10617331_809076355790597_159518095_n.jpg?oh=80b52cb87fbd8568e07d4c1f33431bed&oe=53ED4ECB&__gda__=1408086550_169deb7574e15125c2f0a79dee2fe71a)

my shader...
uniform sampler2D texture;

uniform float distanceToMaxNoise = 1000.0;
uniform float startNoiseDistance = 5000.0;

uniform vec2 position = vec2(0,0);
uniform float random = 1.0;

highp float randFloat(vec2 co)
{
    highp float a = 12.9898;
    highp float b = 78.233;
    highp float c = 43758.5453;
    highp float dt= dot(co.xy ,vec2(a,b));
    highp float sn= mod(dt,3.14);
    return fract(sin(sn) * c);
}

void main()
{
        vec2 texCoord = gl_TexCoord[0].xy;
        vec2 randomVec = vec2(random);
        vec2 texCoordRandom = texCoord + randomVec;
    vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);

        highp float randomNoise = randFloat(texCoordRandom);
        highp float randomLine = randFloat(texCoord.yy + randomVec);

        float distance = clamp(length(position) - startNoiseDistance, 0.0, distanceToMaxNoise);
        float noise = clamp(distance / distanceToMaxNoise, 0.0, 1.0);

        pixel = mix(pixel, vec4(randomNoise, randomNoise, randomNoise, 1.0), noise);

        if(randomLine < 0.02)
        {
                pixel = mix(pixel, vec4(0.0, 0.0, 0.0, 1.0), noise);
        }

        gl_FragColor = pixel;
}

from what i can tell #version 120 is from 2006 so does that mean his GFX card is outdated? If this happens on his computer i think its likely that other computers will experience the same problem. Is there something I can do that will automatically address the problem by prompting the user to update their drivers or something?
Title: Re: Outdated openGL?
Post by: Jesper Juhl on August 13, 2014, 07:32:51 pm
When you create your window (http://www.sfml-dev.org/documentation/2.1/classsf_1_1Window.php#a1bee771baecbae6d357871929dc042a2) you can pass in the ContextSettings (http://www.sfml-dev.org/documentation/2.1/structsf_1_1ContextSettings.php) you require.
You can then call getSettings (http://www.sfml-dev.org/documentation/2.1/classsf_1_1Window.php#a5a9d5c15facf25ad4d9b2b30caa0a2db) to check that you got what you needed and tell the user if you did not. You could also selectively disable or degrade things (like certain shaders) if your didn't get what you asked for but have alternatives you can then use instead.
Title: Re: Outdated openGL?
Post by: binary1248 on August 14, 2014, 02:15:32 am
GLSL is just like any other high level language. It is written as a standard and standards change over time. You should really just read and try to understand what that warning is telling you if you really want to make use of GLSL.

This (http://www.opengl.org/wiki/Core_Language_%28GLSL%29#Version) might also help, like all other documentation that is available.