<HTML>
<HEAD>
<TITLE>Re: [vtk-developers] ReadOpenGLExtensions() should not call Render()</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I think we can all agree that having vtkOpenGLExtensionManager call Render is not a great idea. The problem is that there is a chicken-and-egg problem where vtkOpenGLExtensionManager needs the OpenGL context already created to accurately report the extensions supported, but you often want query available extensions early in initialization before rendering occurs.<BR>
<BR>
So, how should ReadOpenGLExtensions behave if the context has not yet been created? Perhaps vtkRenderWindow could expose a method that forces the context to be created. But does that actually solve the problem? Could this still cause problems if the user has not set up size, position, offscreen rendering, alpha channel, etc? What if the render window is later used with a QVTKWidget?<BR>
<BR>
Perhaps ReadOpenGLExtensions should just error out if the OpenGL context is not yet created. This might “break” a lot of existing code, but should we consider that code already broken? If this is the right solution, then vtkRenderWindow should probably still get a method that forces the context to created. That would allow users to initialize the parameters of the render window, create the OpenGL context, and then use vtkOpenGLExtensionManager to initialize the rest of the rendering.<BR>
<BR>
-Ken<BR>
<BR>
<BR>
On 9/7/10 7:30 AM, "David Gobbi" <<a href="david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hi All,<BR>
<BR>
I have a little complaint about this code in<BR>
vtkOpenGLExtensionManager::ReadOpenGLExtensions()<BR>
<BR>
this->RenderWindow->MakeCurrent();<BR>
if (!this->RenderWindow->IsCurrent())<BR>
{<BR>
// Really should create a method in the render window to create<BR>
// the graphics context instead of forcing a full render.<BR>
this->RenderWindow->Render();<BR>
}<BR>
<BR>
Calling Render() inside ReadOpenGLExtensions() is a bad thing. It can<BR>
cause the first render to occur as a side effect, and it might result<BR>
in the window being rendered before it has been properly sized and<BR>
positioned. From what I've seen, this Render always gets called on<BR>
Windows but never on X. This render was also the cause of bug 11208<BR>
(<a href="http://www.vtk.org/Bug/view.php?id=11208">http://www.vtk.org/Bug/view.php?id=11208</a>) which took me the better<BR>
part of a day to track down.<BR>
<BR>
David<BR>
_______________________________________________<BR>
Powered by www.kitware.com<BR>
<BR>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><BR>
<BR>
Follow this link to subscribe/unsubscribe:<BR>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers">http://www.vtk.org/mailman/listinfo/vtk-developers</a><BR>
<BR>
<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'><BR>
**** Kenneth Moreland<BR>
*** Sandia National Laboratories<BR>
*********** <BR>
*** *** *** email: <a href="kmorel@sandia.gov">kmorel@sandia.gov</a><BR>
** *** ** phone: (505) 844-8919<BR>
*** web: <a href="http://www.cs.unm.edu/~kmorel">http://www.cs.unm.edu/~kmorel</a><BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT>
</BODY>
</HTML>