[vtkusers] VTK Carbon AGLContext

Clinton Stimpson clinton at elemtech.com
Wed Jul 21 14:49:23 EDT 2010


On 07/20/2010 07:17 AM, Stephen Furlani wrote:
> Hello,
>
> I have a noob question regarding the use of OpenGL/VTK, and there wasn't
> much on the list about Carbon.
>
> I already have an AGLContext, Window, and ContentView in my software.  I've
> set the RootWindow and WindowID to the appropriate values, but when I call
> "renwin->Render()" it tries to create a GLContext
>
> Program received signal:  “EXC_BAD_ACCESS”.
> (gdb)  bt
> #0  0x00000000 in ?? ()
> #1  0x005c631d in vtkOpenGLRenderWindow::OpenGLInit ()
> #2  0x0060c95b in vtkCarbonRenderWindow::CreateAWindow ()
> #3  0x0060a3aa in vtkCarbonRenderWindow::WindowInitialize ()
> #4  0x0060bfa5 in vtkCarbonRenderWindow::Initialize ()
> #5  0x00608d00 in vtkCarbonRenderWindow::Start ()
> #6  0x00571b70 in vtkRenderWindow::DoStereoRender ()
> #7  0x005721a5 in vtkRenderWindow::DoFDRender ()
> #8  0x005728fe in vtkRenderWindow::DoAARender ()
> #9  0x00572feb in vtkRenderWindow::Render ()
>
> When I ask for the pointers I get the following:
>
> vtkCarbonRenderWindow *renWin = vtkCarbonRenderWindow::New();
> renWin->SetRootWindow(winref);
> renWin->SetWindowId(HIViewGetRoot(winref));
>
> SFLog(@"Window: 0x%x == 0x%x", renWin->GetRootWindow(), winref);
> SFLog(@"HiView: 0x%x == 0x%x", renWin->GetWindowId(),
> HIViewGetRoot(winref));
> SFLog(@"AGLContext: 0x%x == 0x%x", renWin->GetContextId(),
> eqWindow->getAGLContext());
>
>   SFLOG: void Channel::drawVTK() [Line 142] Window: 0x1c505e0 == 0x1c505e0
>   SFLOG: void Channel::drawVTK() [Line 143] HiView: 0x1c4ed40 == 0x1c4ed40
>   SFLOG: void Channel::drawVTK() [Line 144] AGLContext: 0x0 == 0x1f107200
>
> How can I use an already-created AGLContext?  I could only find a getter for
> it.
>
> I'm using the Equalizer API for cluster graphics, so it already creates the
> windows, contexts, etc.
>
> Is what I want to do possible?  Is there a different way to go about doing
> it? Will I need to write another subclass of vtkOpenGLRenderWindow to work
> with Equalizer instead of the default Carbon one?
>
>    

You may want to consider using the new vtkGenericOpenGLRenderWindow 
class in VTK.
http://www.vtk.org/doc/nightly/html/classvtkGenericOpenGLRenderWindow.html
That is basically like a vtkOpenGLRenderWindow subclass that you could 
write yourself.

Clint




More information about the vtkusers mailing list