Hello Victor,
On 2016-11-01 15:08, Victor Haefner wrote:
> 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.
hmm, the only things that come to mind are:
- is the OpenGL context for that OSG::Window active at the point in time
when you make those calls?
- has OpenSG had a chance to create, compile, and link the program? This
would probably happen as part of the first render that uses the program.
> 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
Well, the shader gets compiled twice (once by OpenSG, once by you for
error checking).
Cheers,
Carsten
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users