[vtk-developers] ReadOpenGLExtensions() should not call Render()
David Gobbi
david.gobbi at gmail.com
Tue Sep 7 14:02:55 EDT 2010
Hi Clinton,
On Windows, calling Start() will indirectly call CreateAWindow() so it
doesn't avoid the window creation issue. Requiring that people call
Start() before ReadOpenGLExtensions() introduces backwards
incompatibility.
I think that having ReadOpenGLExtensions() generate an error if the
context hasn't been created is the correct solution, and like Kenneth
says this means that the user will have to call a context-creation
method like Start() before querying the extensions. I'm not fond of
backwards incompatibility, but considering the wide range of
circumstances under which windows can be created (different operating
systems, different GUIs) I don't think there is any other option that
could be considered to be a stable solution.
David
On Tue, Sep 7, 2010 at 11:40 AM, Clinton Stimpson <clinton at elemtech.com> wrote:
>
> There is already a vtkRenderWindow::Start() which creates a context before
> rendering, so after that, one can query extensions.
>
> Clint
>
> On Tuesday, September 07, 2010 11:23:44 am Moreland, Kenneth wrote:
>> 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.
>>
>> 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?
>>
>> 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.
>>
>> -Ken
>>
>>
>> On 9/7/10 7:30 AM, "David Gobbi" <david.gobbi at gmail.com> wrote:
>>
>> Hi All,
>>
>> I have a little complaint about this code in
>> vtkOpenGLExtensionManager::ReadOpenGLExtensions()
>>
>> this->RenderWindow->MakeCurrent();
>> if (!this->RenderWindow->IsCurrent())
>> {
>> // Really should create a method in the render window to create
>> // the graphics context instead of forcing a full render.
>> this->RenderWindow->Render();
>> }
>>
>> Calling Render() inside ReadOpenGLExtensions() is a bad thing. It can
>> cause the first render to occur as a side effect, and it might result
>> in the window being rendered before it has been properly sized and
>> positioned. From what I've seen, this Render always gets called on
>> Windows but never on X. This render was also the cause of bug 11208
>> (http://www.vtk.org/Bug/view.php?id=11208) which took me the better
>> part of a day to track down.
>>
>> David
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>>
>>
>>
>>
>> **** Kenneth Moreland
>> *** Sandia National Laboratories
>> ***********
>> *** *** *** email: kmorel at sandia.gov
>> ** *** ** phone: (505) 844-8919
>> *** web: http://www.cs.unm.edu/~kmorel
>
More information about the vtk-developers
mailing list