Commit 804902b1 authored by Ken Martin's avatar Ken Martin
Browse files

Update Cocoas check for OpenGL support

No clue how the previous code had a chance of working
New code should check for what we need.
parent d9b727cc
......@@ -482,12 +482,25 @@ const char* vtkCocoaRenderWindow::ReportCapabilities()
int vtkCocoaRenderWindow::SupportsOpenGL()
#ifdef GLEW_OK
if (!this->GetContextId() || !this->GetPixelFormat())
GLenum result = glewInit();
bool m_valid = (result == GLEW_OK);
if (!m_valid)
return 0;
return 1;
if (GLEW_VERSION_3_2 || (GLEW_VERSION_2_1 && GLEW_EXT_gpu_shader4))
return 1;
return 0;
......@@ -716,11 +729,10 @@ void vtkCocoaRenderWindow::CreateAWindow()
// So here we call +sharedApplication which will create the NSApplication
// if it does not exist. If it does exist, this does nothing.
// We are not actually interested in the return value.
// This call is intentionally delayed until this CreateAWindow call
// to prevent Cocoa-window related stuff from happening in scenarios
// where vtkRenderWindows are created but never shown.
(void)[NSApplication sharedApplication];
NSApplication* app = [NSApplication sharedApplication];
// create an NSWindow only if neither an NSView nor an NSWindow have
// been specified already. This is the case for a 'pure vtk application'.
......@@ -728,6 +740,11 @@ void vtkCocoaRenderWindow::CreateAWindow()
// SetRootWindow() and SetWindowId() so that a window is not created here.
if (!this->GetRootWindow() && !this->GetWindowId() && !this->GetParentId())
// Ordinarily, only .app bundles get proper mouse and keyboard interaction,
// but here we change the 'activation policy' to behave as if we were a
// .app bundle (which we may or may not be).
(void)[app setActivationPolicy:NSApplicationActivationPolicyRegular];
NSWindow* theWindow = nil;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment