Hello Carsten,

I tried with

    char errbuf[4096];
    GLsizei len;
    GLint link_ok = GL_FALSE;
    VRWindowPtr window = VRSetup::getCurrent()->
getWindows().begin()->second;
    if (!window) return;
    Window* pWin = window->getOSGWindow();
    GLuint uiProgram = GLuint(pWin->getGLObjectId(p->getGLId()));
    if (!uiProgram) return;

    glGetProgramInfoLog(uiProgram, sizeof(errbuf), &len, errbuf);
    glGetProgramiv(uiProgram, GL_LINK_STATUS, &link_ok);
    if (!link_ok)  {
        string e = "The shaders did not link correctly: ";
        e += string(errbuf);
        VRGuiManager::get()->printToConsole("Errors", e);
    }

but I did not get anything usefull.

So I just compile the shader and get the logs

    GLuint shaderObject = glCreateShader(type);
    int N = shader.size();
    const char* str = shader.c_str();
    glShaderSourceARB(shaderObject, 1, &str, &N);
    glCompileShaderARB(shaderObject);

    GLint compiled;
    glGetObjectParameterivARB(shaderObject, GL_COMPILE_STATUS, &compiled);
    if (!compiled) gm->printToConsole("Errors", "Shader "+name+" of
material "+getName()+" did not compiled!\n");

    GLint blen = 0;
    GLsizei slen = 0;
    glGetShaderiv(shaderObject, GL_INFO_LOG_LENGTH , &blen);
    if (blen > 1) {
        GLchar* compiler_log = (GLchar*)malloc(blen);
        glGetInfoLogARB(shaderObject, blen, &slen, compiler_log);
        VRGuiManager::get()->printToConsole("Errors", string(compiler_log));
        free(compiler_log);
    }

Would there be a downside on that approach?
At least it works with the osg attributes

Best Regards,
Victor




Mit freundlichen Grüßen,
Victor Häfner

On Wed, Oct 19, 2016 at 3:56 PM, Carsten Neumann <
carsten.p.neum...@gmail.com> wrote:

>         Hello Victor,
>
> On 2016-10-19 02:41, Victor Haefner wrote:
> > I have a tool, an editor, where users can write GLSL shader,
> > but I am still missing warning and error output in the gui.
> >
> > How could I get the error logs of the shader compilation and linkage
> > from OpenSG?
>
> I don't think that is exposed at the moment. When a shader is compiled
> it is checked for success and any errors are logged (through the usual
> OpenSG log).
> IIRC there are ways to intercept the log streams - but you would likely
> get other messages as well, not just those from the shader compiles. I
> guess the other option could be to get the real GL id of the shader
> object (Window::getGLObjectId, I think) and make the necessary GL calls
> directly - ensuring that the correct GL context corresponding to the
> Window is active at the time.
>
>         Cheers,
>                 Carsten
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Opensg-users mailing list
> Opensg-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to