p0nce / y4m-tools

Various command-line Y4M tools
0 stars 0 forks source link

Doesn't work on macOS #5

Open NightMachinery opened 6 years ago

NightMachinery commented 6 years ago
 ./shader-capture -fs shader1.glsl -fps 30 -t 10 -x 16      ILL(-4)|1 ↵  9966  18:15:36
YUV4MPEG2 W1920 H1080 F30:1 A1:1 Ip C444
No existing vertex shader provided, using a default one.
info: ERROR: 0:1: '' :  version '110' is not supported
ERROR: 0:2: '' :  #version required and missing.
WARNING: 0:6: extension 'GL_OES_standard_derivatives' is not supported

error: shader did not compile

Shader Capture

usage: shader-capture [-w 1920] [-h 1080] [-x 1] [-fps 60] [-t 1] [-vs vertex.glsl] [-fs fragment.glsl] > output.y4m [-h]

Arguments:
    -w            Sets width of output video (default: 1920).
    -h            Sets height of output video (default: 1080).
    -x            Oversampling 1x 4x 16x or 64x (default: 1).
    -fps          Sets framerate of output video (default: 60).
    -t            Time duration of the video in seconds (default: 1).
    -vs           Use this vertex shader (default: builtin shader)
    -fs           Use this vertex shader (default: fragment-shader.glsl)
    -no-output    Do not output a video, to test speed. (default: do output)
    -help         Shows this help.

Error: clean-up of GLFBO incorrectly depends on destructors called by the GC.
[1]    98242 illegal hardware instruction  ./shader-capture -fs shader1.glsl -fps 30 -t 10 -x 16

My shader:

#ifdef GL_ES
precision mediump float;
#endif

#extension GL_OES_standard_derivatives : enable

uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;

void main( void ) {

    //vec2 m = vec2(mouse.x * 2.0 - 1.0, -mouse.y * 2.0 + 1.0);
    vec2 p = (gl_FragCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y);

    // ring
    float t = 0.12* abs(sin(time*cos(time)*0.06)+0.2) / abs(0.5 - length(p));

    gl_FragColor = vec4(vec3(t), 1.0);

}
p0nce commented 6 years ago

Yup, what I do is a manual work-around:

extension GL_OES_standard_derivatives : enable



- rename `gl_FragColor` to `fragColor`
- add `out vec4 fragColor` to the fragment shader

It's because we create a Desktop OpenGL context, not WebGL or OpenGL ES.
p0nce commented 6 years ago

Your shader, fixed:

uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
out vec4 fragColor;

void main( void ) {

    //vec2 m = vec2(mouse.x * 2.0 - 1.0, -mouse.y * 2.0 + 1.0);
    vec2 p = (gl_FragCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y);

    // ring
    float t = 0.12* abs(sin(time*cos(time)*0.06)+0.2) / abs(0.5 - length(p));

   fragColor = vec4(vec3(t), 1.0);

}
NightMachinery commented 6 years ago

Thank you. ❤️

On Wed, Aug 8, 2018 at 1:03 AM Guillaume Piolat notifications@github.com wrote:

Your shader, fixed:

uniform float time; uniform vec2 mouse; uniform vec2 resolution; out vec4 fragColor;

void main( void ) {

//vec2 m = vec2(mouse.x * 2.0 - 1.0, -mouse.y * 2.0 + 1.0);
vec2 p = (gl_FragCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y);

// ring
float t = 0.12* abs(sin(time*cos(time)*0.06)+0.2) / abs(0.5 - length(p));

fragColor = vec4(vec3(t), 1.0);

}

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/p0nce/y4m-tools/issues/5#issuecomment-411192674, or mute the thread https://github.com/notifications/unsubscribe-auth/Aii--goUxT68J71wSHKzkDxl_o4sPAXUks5uOfmjgaJpZM4VyMUf .

p0nce commented 6 years ago

Reopen since the README says "out of the box" well not on macOS