OpenGL Error #6

Closed
opened 2014-04-03 00:35:55 +02:00 by lepz0r · 4 comments
lepz0r commented 2014-04-03 00:35:55 +02:00 (Migrated from github.com)

Pink screen when i start the terminal and when i start it with another terminal

I'm running kubuntu 12.04

loadAllColorSchemes 
QOpenGLShader::compile(Fragment): 0:43(17): error: assignment to read-only variable 'noise_strength'

*** Problematic Fragment shader source code ***
#define lowp
#define mediump
#define highp

            uniform sampler2D source;
            uniform highp float qt_Opacity;
            uniform highp float time;
            uniform highp vec2 txt_Size;
            varying highp vec2 qt_TexCoord0;

            uniform highp vec4 font_color;
            uniform highp vec4 background_color;
            uniform highp float deltax;
            uniform highp float deltay;
        uniform highp sampler2D bloomSource;
        uniform highp float noise_strength;
        uniform highp float screen_distorsion;
        uniform highp float glowing_line_strength;
        varying lowp float brightness;
        varying lowp float horizontal_distortion;
    highp float rand(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);
    }

    float stepNoise(vec2 p){
        vec2 newP = p * txt_Size*0.5;
        return rand(floor(newP) + fract(time / 100.0));
    }
        float randomPass(vec2 coords){
            return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0001))) * glowing_line_strength;
        }void main() {vec2 cc = vec2(0.5) - qt_TexCoord0;float distance = length(cc);
            float distortion = dot(cc, cc) * screen_distorsion;
            vec2 coords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);
            float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0));
            h_distortion += 0.5 * cos(time*0.04 + 0.03 + coords.y*50.0*fract(time/10.0 + 0.4));
            coords.x = coords.x + h_distortion * horizontal_distortion;
                noise_strength += horizontal_distortion * 0.5;float color = texture2D(source, coords).r;
            color += texture2D(bloomSource, coords).r *1.5;
            color += stepNoise(coords) * noise_strength * (1.0 - distance * distance * 2.0);
            color += randomPass(coords) * glowing_line_strength;vec3 finalColor = mix(background_color, font_color, color).rgb;finalColor = mix(finalColor * 1.1, vec3(0.0), 1.2 * distance * distance);
            finalColor = mix(finalColor, vec3(0.0), brightness);
        gl_FragColor = vec4(finalColor *1.25, 1.0);
    } 
***
QQuickCustomMaterialShader: Shader compilation failed:
"0:43(17): error: assignment to read-only variable 'noise_strength'
" 
QOpenGLShader::compile(Fragment): 0:28(7): error: type mismatch
0:30(17): error: too many parameters to `vec4' constructor

*** Problematic Fragment shader source code ***
#define lowp
#define mediump
#define highp

                            uniform sampler2D source;
                            uniform sampler2D normals;
                            uniform highp float screen_distorsion;
                            uniform highp float ambient_light;

                            uniform vec4 reflection_color;
                            varying lowp float brightness;

                            varying highp vec2 qt_TexCoord0;

                            vec2 distortCoordinates(vec2 coords){
                                vec2 cc = coords - vec2(0.5);
                                float dist = dot(cc, cc) * screen_distorsion;
                                return (coords + cc * (1.0 + dist) * dist);
                            }

                            void main(){
                                vec2 coords = distortCoordinates(qt_TexCoord0);
                                vec4 txt_color = texture2D(source, coords);
                                vec4 txt_normal = texture2D(normals, coords);
                                vec3 normal = normalize(txt_normal.rgb * 2.0 - 1.0);
                                vec3 light_dir = normalize(vec3(0.5,0.5, 0.0) - vec3(qt_TexCoord0, 0.0));
                                float reflection = (dot(normal, light_dir) * 0.4 + 0.2) * brightness;
                                vec3 final_color = reflection_color * reflection * 0.5;
                                final_color += txt_color * ambient_light;
                                gl_FragColor = vec4(final_color * txt_normal.a, txt_color.a);
                            } 
***
QQuickCustomMaterialShader: Shader compilation failed:
"0:28(7): error: type mismatch
0:30(17): error: too many parameters to `vec4' constructor
" 
Pink screen when i start the terminal and when i start it with another terminal I'm running kubuntu 12.04 ``` loadAllColorSchemes QOpenGLShader::compile(Fragment): 0:43(17): error: assignment to read-only variable 'noise_strength' *** Problematic Fragment shader source code *** #define lowp #define mediump #define highp uniform sampler2D source; uniform highp float qt_Opacity; uniform highp float time; uniform highp vec2 txt_Size; varying highp vec2 qt_TexCoord0; uniform highp vec4 font_color; uniform highp vec4 background_color; uniform highp float deltax; uniform highp float deltay; uniform highp sampler2D bloomSource; uniform highp float noise_strength; uniform highp float screen_distorsion; uniform highp float glowing_line_strength; varying lowp float brightness; varying lowp float horizontal_distortion; highp float rand(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); } float stepNoise(vec2 p){ vec2 newP = p * txt_Size*0.5; return rand(floor(newP) + fract(time / 100.0)); } float randomPass(vec2 coords){ return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0001))) * glowing_line_strength; }void main() {vec2 cc = vec2(0.5) - qt_TexCoord0;float distance = length(cc); float distortion = dot(cc, cc) * screen_distorsion; vec2 coords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion); float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0)); h_distortion += 0.5 * cos(time*0.04 + 0.03 + coords.y*50.0*fract(time/10.0 + 0.4)); coords.x = coords.x + h_distortion * horizontal_distortion; noise_strength += horizontal_distortion * 0.5;float color = texture2D(source, coords).r; color += texture2D(bloomSource, coords).r *1.5; color += stepNoise(coords) * noise_strength * (1.0 - distance * distance * 2.0); color += randomPass(coords) * glowing_line_strength;vec3 finalColor = mix(background_color, font_color, color).rgb;finalColor = mix(finalColor * 1.1, vec3(0.0), 1.2 * distance * distance); finalColor = mix(finalColor, vec3(0.0), brightness); gl_FragColor = vec4(finalColor *1.25, 1.0); } *** QQuickCustomMaterialShader: Shader compilation failed: "0:43(17): error: assignment to read-only variable 'noise_strength' " QOpenGLShader::compile(Fragment): 0:28(7): error: type mismatch 0:30(17): error: too many parameters to `vec4' constructor *** Problematic Fragment shader source code *** #define lowp #define mediump #define highp uniform sampler2D source; uniform sampler2D normals; uniform highp float screen_distorsion; uniform highp float ambient_light; uniform vec4 reflection_color; varying lowp float brightness; varying highp vec2 qt_TexCoord0; vec2 distortCoordinates(vec2 coords){ vec2 cc = coords - vec2(0.5); float dist = dot(cc, cc) * screen_distorsion; return (coords + cc * (1.0 + dist) * dist); } void main(){ vec2 coords = distortCoordinates(qt_TexCoord0); vec4 txt_color = texture2D(source, coords); vec4 txt_normal = texture2D(normals, coords); vec3 normal = normalize(txt_normal.rgb * 2.0 - 1.0); vec3 light_dir = normalize(vec3(0.5,0.5, 0.0) - vec3(qt_TexCoord0, 0.0)); float reflection = (dot(normal, light_dir) * 0.4 + 0.2) * brightness; vec3 final_color = reflection_color * reflection * 0.5; final_color += txt_color * ambient_light; gl_FragColor = vec4(final_color * txt_normal.a, txt_color.a); } *** QQuickCustomMaterialShader: Shader compilation failed: "0:28(7): error: type mismatch 0:30(17): error: too many parameters to `vec4' constructor " ```
Swordfish90 commented 2014-04-03 01:02:58 +02:00 (Migrated from github.com)

Thank you for the reporting!... It is definitely a problem with my shader (that for some reason didn't happen on my hardware). Now it's late here, but tomorrow I'm going to fix it.

Thank you for the reporting!... It is definitely a problem with my shader (that for some reason didn't happen on my hardware). Now it's late here, but tomorrow I'm going to fix it.
Swordfish90 commented 2014-04-03 15:31:15 +02:00 (Migrated from github.com)

In theory it should now be fixed. When you have time retest it and let me know.

In theory it should now be fixed. When you have time retest it and let me know.
lepz0r commented 2014-04-04 01:22:47 +02:00 (Migrated from github.com)

noise_strength error is gone, but there still vec4 error

noise_strength error is gone, but there still vec4 error
Swordfish90 commented 2014-04-04 02:36:09 +02:00 (Migrated from github.com)

Just pushed a new version, let's try with this one. There was an implicit conversion. Now I have enabled all the warnings, so hopefully I will be able to see the problems also on my machine and this won't happen again.

Just pushed a new version, let's try with this one. There was an implicit conversion. Now I have enabled all the warnings, so hopefully I will be able to see the problems also on my machine and this won't happen again.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seeseemelk/cool-retro-term#6
No description provided.