<br>Right on, guys!<br><br>In lines 580 -- 606 of vtk 5.2.1 :: vtkCocoaRenderWindow.mm, we have<br><br><font size="1"><span style="font-family: courier new,monospace;">//----------------------------------------------------------------------------</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">void vtkCocoaRenderWindow::CreateGLContext()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">{</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> NSOpenGLPixelFormatAttribute attribs[] =</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> NSOpenGLPFAAccelerated,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> NSOpenGLPFADepthSize,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> (NSOpenGLPixelFormatAttribute)32,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (this->DoubleBuffer != 0) ?</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> (NSOpenGLPixelFormatAttribute)NSOpenGLPFADoubleBuffer :</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (NSOpenGLPixelFormatAttribute)nil,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> (NSOpenGLPixelFormatAttribute)nil</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> };</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> NSOpenGLPixelFormat* pixelFormat = [[[NSOpenGLPixelFormat alloc]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> initWithAttributes:attribs] autorelease];</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> NSOpenGLContext* context = [[[NSOpenGLContext alloc]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> initWithFormat:pixelFormat</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> shareContext:nil] autorelease];</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> // This syncs the OpenGL context to the VBL to prevent tearing</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> //GLint one = 1;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> GLint one = 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> [context setValues:&one forParameter:NSOpenGLCPSwapInterval];</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> this->SetPixelFormat((void*)pixelFormat);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> this->SetContextId((void*)context);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">}</span></font><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><br>SO I switched to: <span style="font-family: courier new,monospace;">GLint one = 0;</span> and these are the results:<br>
<br><span style="font-family: courier new,monospace;">[ dweber@XXX ~/src/kitware/VTK_build ]$ time ./bin/Cone</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">real        0m0.432s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">user        0m0.191s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sys        0m0.076s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[ dweber@XXX ~/src/kitware/VTK_build ]$ time ./bin/Cone</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">real        0m0.408s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">user        0m0.191s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sys        0m0.077s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[ dweber@XXX ~/src/kitware/VTK_build ]$ time ./bin/Cone</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">real        0m0.405s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">user        0m0.196s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sys        0m0.077s</span><br style="font-family: courier new,monospace;">
<br><br>Mucho gracias, amigos!<br><br><br>PS, Note the comment in the code about tearing, may be important for some apps to switch over to sync mode.<br><br><br><br>On Thu, Mar 12, 2009 at 5:02 PM, Sean McBride <<a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a>> wrote:<br>
> On 3/12/09 7:50 PM, Francois Bertel said:<br>><br>>>Hello,<br>>><br>>>If your display has a vertical refresh rate of 60Hz and the vertical<br>>>blank sync is set on your system,<br>>>each rendering of a frame waits for the next vertical blank to swap<br>
>>the front and back buffer.<br>>><br>>>360 frames/60Hz=6s.<br>>><br>>>I don't know how you can switch that off as a end-user on Mac.<br>><br>> François,<br>><br>> Good thinking. VBL sync is always on in vtkCocoaRenderWindow. This is<br>
> the responsible snippit:<br>><br>> [context setValues:&one forParameter:NSOpenGLCPSwapInterval];<br>><br>> Darren, try commenting that line out and rebuilding VTK. See if<br>> François' theory is correct.<br>
><br>> --<br>> ____________________________________________________________<br>> Sean McBride, B. Eng <a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a><br>> Rogue Research <a href="http://www.rogue-research.com">www.rogue-research.com</a><br>
> Mac Software Developer Montréal, Québec, Canada<br>><br>><br>> _______________________________________________<br>> Powered by <a href="http://www.kitware.com">www.kitware.com</a><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>> Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">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">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>><br><br>