<div dir="ltr">Hi Bill,<div><br></div><div>due to the fact my code significantly changed w.r.t. when I encountered that issue, as of now I am unable to exactly reproduce the same usage case as when I originally obtained that issue.</div>
<div>Nevertheless, I assembled a more "isolated" test using this macro, and I think it is working fine now for me.</div><div><br></div><div>Just a question: what's the purpose of the code line:</div><div><br>
</div><div>[...]</div><div><span class="" style="color:rgb(68,68,0);font-family:monospace;font-size:11px;white-space:pre">(</span><span class="" style="color:rgb(0,0,102);font-weight:bold;font-family:monospace;font-size:11px;white-space:pre">void</span><span class="" style="color:rgb(68,68,0);font-family:monospace;font-size:11px;white-space:pre">)</span><span class="" style="color:rgb(0,0,0);font-family:monospace;font-size:11px;white-space:pre"> maxErrors</span><span class="" style="color:rgb(68,68,0);font-family:monospace;font-size:11px;white-space:pre">;</span><br>
</div><div><span class="" style="color:rgb(68,68,0);font-family:monospace;font-size:11px;white-space:pre"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;white-space:normal">[...]</span><br></span></div>
<div><span class="" style="color:rgb(68,68,0);font-family:monospace;font-size:11px;white-space:pre"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;white-space:normal"><br></span></span></div><div>inside the body of the <span style="background-color:rgb(221,255,221);color:rgb(0,0,0);font-family:monospace;font-size:11px;white-space:pre">vtkClearOpenGLErrors </span>macro, in case the <span style="color:rgb(102,0,0);font-family:monospace;font-size:11px;font-style:italic;white-space:pre">VTK_REPORT_OPENGL_ERRORS </span>symbol is not defined?</div>
<div><br></div><div>Thanks again for your time and the patch.</div><div>In the near future, I will probably introduce more changes in my code, and I will be able to test the patch more throughly. But I am sure it will work.</div>
<div><br></div><div>Best regards,</div><div><br></div><div>Marco Sambin</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 15, 2014 at 7:54 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Richard and Marco,<br><br></div>If you can verify this patch solves your problem, I'll merge it.<br>
<br></div>Thanks,<br><br></div>Bill<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Apr 15, 2014 at 11:35 AM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Here is a patch; <a href="http://review.source.kitware.com/#/c/15149/" target="_blank">http://review.source.kitware.com/#/c/15149/</a><span><font color="#888888"><div><br></div><div>Bill</div>
<div><br></div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Apr 15, 2014 at 11:31 AM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr">I see 16 is already used as a limit in some other calls, so I'll make that the default.<div><br></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Apr 15, 2014 at 11:07 AM, Aashish Chaudhary <span dir="ltr"><<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">IMO, a number of 10 should be reasonable. <span style="font-family:arial,sans-serif;font-size:12.727272033691406px">glGetError call is an expensive call and if that's happening at the exit, that may be Ok but not while the application is active. </span><div>




<br><font face="arial, sans-serif">Also, typically you run into 2-3 error codes (at least my experience). It would be nice if this could be an option that you can pass to the macro. <br><br></font></div><div><font face="arial, sans-serif">Just my thoughts. </font></div>




<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">-Aashish</font></div><div><font face="arial, sans-serif"><br></font></div></div><div class="gmail_extra"><div><div><br><br>
<div class="gmail_quote">
On Tue, Apr 15, 2014 at 10:57 AM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">Hmmm. I can put a limit on the number of times the while loops execute, but I'm not sure what that limit should be. There are many possible gl errors (and glu errors)<div><br></div></div><div>
<div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Apr 15, 2014 at 8:59 AM, Marco Sambin <span dir="ltr"><<a href="mailto:m.sambin@gmail.com" target="_blank">m.sambin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<p dir="ltr">Great Bill,</p>
<p dir="ltr">thanks for your comments and thank you in advance for the patch.<br>
Best regards,</p>
<p dir="ltr">Marco<br>
</p>
<div class="gmail_quote">Il 15/apr/2014 14:42 "Bill Lorensen" <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>> ha scritto:<div><div><br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">It seems risky to have glGetError in a while loop without a guard to stop the loop. According to the open GL Super Bible, the safe way to clear the error is:<div><div>GLenum glError;</div><div>unsigned int i = 0;</div>







<div>  do</div><div>    {</div><div>    glError = glGetError();</div><div>    ++i;</div><div>    }</div><div>  while(i < 6 && glError != GL_NO_ERROR);</div></div><div><br></div><div>I have see some docs that say there can be more  error codes. Certainly, some upper bound should be set.</div>







<div><br></div><div>I'll prepare a patch.</div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 15, 2014 at 5:58 AM, Richard Whitehead <span dir="ltr"><<a href="mailto:richard.whitehead@vivosight.com" target="_blank">richard.whitehead@vivosight.com</a>></span> wrote:<br>







<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Marco,<div>Thanks for the support!  I only get it on one of my computers, where OpenGL is issuing warnings, but then the purpose of this code is to clear warnings...  It simply doesn't work.  Hopefully someone who knows what it's doing could fix it.</div>








<div>Thanks again,</div><div>Richard</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On 15 April 2014 10:49, Marco Sambin <span dir="ltr"><<a href="mailto:m.sambin@gmail.com" target="_blank">m.sambin@gmail.com</a>></span> wrote:<br>








<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Richard,<div><br></div><div>quite a while ago, while I was making experiments with the use of JOGL with VTK under Windows, I encountered the same issue that you describe.</div>








<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">Basically, in some cases my application got stuck, and the CPU usage went up to 25% (I have a quad core processor on my dev PC). I discovered this was due to a "vtkClearOpenGLErrors()" call in the rendering pipeline, which was iterating indefinitely in its "while" loop. Not sure what was the real cause of this, did not have the time to debug in detail. At that time, I worked around the problem by setting the VTK_REPORT_OPENGL_ERRORS option to "false" on CMake (which forces the implementation of vtkClearOpenGLErrors() to be empty). I understand that this may not be a viable workaround in your case, and I also believe it would be good to understand the real cause for this infinite loop inside </span><span style="font-family:arial,sans-serif;font-size:13px">vtkClearOpenGLErrors().</span><br>









</div><div><br></div><div>But for now, I can only let you know that "you are not alone" ;-)</div><div><br></div><div>Maybe someone else on the list can shed some more light or share some experience about this issue.</div>









<div><br></div><div>Best regards,</div><div><br></div><div>Marco</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 14, 2014 at 1:04 PM, Richard Whitehead <span dir="ltr"><<a href="mailto:richard.whitehead@vivosight.com" target="_blank">richard.whitehead@vivosight.com</a>></span> wrote:<br>









<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>This new macro was introduced in 6.1.0.  It is getting called when my app exits and it sits in an infinite loop.</div>









<div>The documentation say is t is supposed to silently clear errors, but it is not doing this.</div>
<div><br></div><div>Please can anyone suggest how to fix it?  Since my app is closing I am willing to discard errors, but the only method I can see that should clear errors is, well, vtkOpenGLClearErrorMacro...</div><div>










<br></div><div>Many thanks,</div><div><br></div><div>Richard</div><div><br></div><div><br></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt">










<span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN">Richard Whitehead </span><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">–</span></b><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN"> Senior Imaging Engineer</span></p>










<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">Michelson Diagnostics Ltd</span></b></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt">










<b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">M:</span></b><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN"> <a href="tel:%2B44%20%280%297905%20955276" value="+447905955276" target="_blank">+44 (0)7905 955276</a>   </span><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">T:</span></b><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN"> <a href="tel:%2B44%20%280%2920%208308%201695" value="+442083081695" target="_blank">+44 (0)20 8308 1695</a></span></p>










<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">E: </span></b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(0,176,240)" lang="EN"><a href="mailto:richard.whitehead@vivosight.com" style="color:rgb(17,85,204)" target="_blank"><span style="color:rgb(0,176,240)">richard.whitehead@vivosight.com</span></a></span><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN">   </span><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">W:</span></b><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN"> </span><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(0,176,240)" lang="EN"><a href="http://www.vivosight.com/" style="color:rgb(17,85,204)" target="_blank"><span style="color:rgb(0,176,240)">www.vivosight.com</span></a></span></p>










<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><br></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><a href="http://www.vivosight.com/" target="_blank"><span style="color:windowtext;text-decoration:none"><img src="https://sites.google.com/a/vivosight.com/logo/_/rsrc/1361922206747/home/VivoSight.png" border="0"></span></a></p>










<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><br></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt">










<span style="font-size:7.5pt;font-family:Arial,sans-serif;color:gray">Michelson Diagnostics Ltd, 1 Grays Farm Production Village, Grays Farm Road, Orpington, Kent  BR5 3BD, UK</span></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt">










<span style="font-size:7.5pt;font-family:Arial,sans-serif;color:gray">Registered Office: 3 Shearwater, Maidstone, ME16 0DW.     Registered in England No. 5732681</span></p></div>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN">Richard Whitehead </span><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">–</span></b><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN"> Senior Imaging Engineer</span></p>








<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">Michelson Diagnostics Ltd</span></b></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt">








<b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">M:</span></b><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN"> <a href="tel:%2B44%20%280%297905%20955276" value="+447905955276" target="_blank">+44 (0)7905 955276</a>   </span><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">T:</span></b><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN"> <a href="tel:%2B44%20%280%2920%208308%201695" value="+442083081695" target="_blank">+44 (0)20 8308 1695</a></span></p>








<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">E: </span></b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(0,176,240)" lang="EN"><a href="mailto:richard.whitehead@vivosight.com" style="color:rgb(17,85,204)" target="_blank"><span style="color:rgb(0,176,240)">richard.whitehead@vivosight.com</span></a></span><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN">   </span><b><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)" lang="EN">W:</span></b><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN"> </span><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(0,176,240)" lang="EN"><a href="http://www.vivosight.com/" style="color:rgb(17,85,204)" target="_blank"><span style="color:rgb(0,176,240)">www.vivosight.com</span></a></span></p>








<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><br></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><a href="http://www.vivosight.com/" target="_blank"><span style="color:windowtext;text-decoration:none"><img src="https://sites.google.com/a/vivosight.com/logo/_/rsrc/1361922206747/home/VivoSight.png" border="0"></span></a></p>








<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><br></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt">








<span style="font-size:7.5pt;font-family:Arial,sans-serif;color:gray">Michelson Diagnostics Ltd, 1 Grays Farm Production Village, Grays Farm Road, Orpington, Kent  BR5 3BD, UK</span></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt">








<span style="font-size:7.5pt;font-family:Arial,sans-serif;color:gray">Registered Office: 3 Shearwater, Maidstone, ME16 0DW.     Registered in England No. 5732681</span></p></div>
</div>
</div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>
</blockquote></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>
</div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br></div></div><span><font color="#888888">| Aashish Chaudhary <br>| R&D Engineer         <br>| Kitware Inc.            <br>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>    
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>
</div></div></blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div></div></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</font></span></div>
</blockquote></div><br></div>