Re: Problems using OCIO with QT and QtOpenGLWidget


Patrick Hodoul
 

Hi Haggi,

https://stackoverflow.com/questions/58857698/qtopenglwidget-with-opencolorio-gpu-results-in-black-image
The thread disappeared from stackoverflow so I do not have access to all the source code anymore.

vec4 col = texture3D(tex1, vec3(vTexCoord.st, 0));
The default implementation from ociodisplay is tex1 for the image texture (the 2D texture), and tex2 for the 3D LUT texture (the 3D texture).

Here is the default GLSL ociodisplay fragment shader code:
    // Generated by OpenColorIO
 
    vec4 OCIODisplay(vec4 inPixel, 
        sampler3D lut3d) 
    {
    vec4 out_pixel = inPixel; 
    out_pixel.rgb = max(vec3(1.17549e-38, 1.17549e-38, 1.17549e-38), vec3(1, 1, 1) * out_pixel.rgb + vec3(0.00390625, 0.00390625, 0.00390625));
    out_pixel.rgb = vec3(1.4427, 1.4427, 1.4427) * log(out_pixel.rgb) + vec3(0, 0, 0);
    out_pixel = vec4(0.0769231, 0.0769231, 0.0769231, 1) * out_pixel;
    out_pixel = vec4(0.615385, 0.615385, 0.615385, 0) + out_pixel;
    out_pixel.rgb = texture3D(lut3d, 0.96875 * out_pixel.rgb + 0.015625).rgb;
    return out_pixel;
    }
 
 
 
    uniform sampler2D tex1;
    uniform sampler3D tex2;
 
    void main()
    {
        vec4 col = texture2D(tex1, gl_TexCoord[0].st);
        gl_FragColor = OCIODisplay(col, tex2);
    }

Using the wrong sampler could be an explanation as well as not binding resources. In plain OpenGL, the code for the latter is:
    glUseProgram(g_program);
    glUniform1i(glGetUniformLocation(g_program, "tex1"), 1);
    glUniform1i(glGetUniformLocation(g_program, "tex2"), 2);


Note:
There is another similar thread on stackoverflow, is that the same problem?
https://stackoverflow.com/questions/58879364/how-can-i-solve-gl-invalid-operation-error-with-qopenglwidget

Regards,
Patrick



Join ocio-dev@lists.aswf.io to automatically receive all group messages.