[vtkusers] Offscreen rendering set size of window causes error

Sean Larkin sean.larkin at lickenbrocktech.com
Wed Aug 13 11:04:11 EDT 2014

Hello all,

I have a qt-vtk application that renders 3D data.  The user interface
contains a vtkRenderWindow that displays the combination of its own rendered
data as well as a rendered mask from another offscreen vtkRenderWindow (The
same data is rendered in both windows but with different settings, and then
the offscreen rendered data  is masked and then the masked portions replace
the on screen data in the same portions).  I want the two windows to render
into the same size, so when I resize the displayed render window I get its
size and then set the size of the offscreen render window to that same size.
Then  I call render() on the offscreen window, which causes the following


ERROR: In ..\..\..\VTK Git Source 3-31-14 for
build\Rendering\OpenGL\vtkShaderProgram2.cxx, line 471

vtkShaderProgram2 (00000000051076A0): failed at glAttachShader 1 OpenGL
errors detected

  0 : (1282) Invalid operation


The source code in vtkShaderProgram2.cxx that generates this error is :

    // We compile all the shaders, even if one fails so that

    // we can get info logs for all shaders.

    bool compileDone = true;


    vtkShader2 *s = this->Shaders->GetNextShader();

    while (s)


      // Propagate the context to the shader.



      if (s->GetLastCompileStatus())


        vtkgl::AttachShader(progId, static_cast<GLuint>(s->GetId()));

        vtkOpenGLCheckErrorMacro("failed at glAttachShader");




I have not tried to debug the source code yet, as my code links to a release
build of vtk 6.1.  My guess is that s->GetId() is returning a NULL or
something erroneous.  This has something to do with setting the window to do
offscreen rendering.  When I have the window render on screen I do not get
this error when setting the size.  Can anyone give me any clues as to why I
am getting this error?




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140813/f4ae6c79/attachment.html>

More information about the vtkusers mailing list