<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hello all,<o:p></o:p></p><p class=MsoNormal>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:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>ERROR: In ..\..\..\VTK Git Source 3-31-14 for build\Rendering\OpenGL\vtkShaderProgram2.cxx, line 471<o:p></o:p></p><p class=MsoNormal>vtkShaderProgram2 (00000000051076A0): failed at glAttachShader 1 OpenGL errors detected<o:p></o:p></p><p class=MsoNormal> 0 : (1282) Invalid operation<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The source code in vtkShaderProgram2.cxx that generates this error is :<o:p></o:p></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:green'> // We compile all the shaders, even if one fails so that</span><span style='font-size:9.5pt;font-family:Consolas'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:green'>// we can get info logs for all shaders.</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:blue'>bool</span> compileDone = <span style='color:blue'>true</span>;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:blue'>this</span>->Shaders->InitTraversal();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> vtkShader2 *s = <span style='color:blue'>this</span>->Shaders->GetNextShader();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:blue'>while</span> (s)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:green'>// Propagate the context to the shader.</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> s->SetContext(<span style='color:blue'>this</span>->Context);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> s->Compile();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> <span style='color:blue'>if</span> (s->GetLastCompileStatus())<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> vtkgl::AttachShader(progId, <span style='color:blue'>static_cast</span><GLuint>(s->GetId()));<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> vtkOpenGLCheckErrorMacro(<span style='color:#A31515'>"failed at glAttachShader"</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'> }<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks,<o:p></o:p></p><p class=MsoNormal>Sean<o:p></o:p></p></div></body></html>