dynamically switch between OpenGL 2 and OpenGL 3 (test gwen)

This commit is contained in:
Erwin Coumans
2014-06-30 14:42:11 -07:00
parent 473c2d43bf
commit 8e2a4f8171
2 changed files with 54 additions and 65 deletions

View File

@@ -339,8 +339,10 @@ void MacOpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
// https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/CapturingScreenContents/CapturingScreenContents.html#//apple_ref/doc/uid/TP40012302-CH10-SW1
//support HighResolutionOSX for Retina Macbook
[m_internalData->m_myview setWantsBestResolutionOpenGLSurface:YES];
if (ci.m_openglVersion>=3)
{
[m_internalData->m_myview setWantsBestResolutionOpenGLSurface:YES];
}
NSSize sz;
sz.width = 1;
sz.height = 1;
@@ -354,29 +356,18 @@ void MacOpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
[m_internalData->m_window setContentView: m_internalData->m_myview];
GLuint n = 1;
GLuint vbo[3]={-1,-1,-1};
glGenBuffers(n, vbo);
checkError("glGenBuffers");
[m_internalData->m_window setDelegate:(id) m_internalData->m_myview];
glGenBuffers(n, vbo);
checkError("glGenBuffers");
[m_internalData->m_window makeKeyAndOrderFront: nil];
[m_internalData->m_myview MakeCurrent];
m_internalData->m_width = m_internalData->m_myview.GetWindowWidth;
m_internalData->m_height = m_internalData->m_myview.GetWindowHeight;
glGenBuffers(n, vbo);
checkError("glGenBuffers");
[NSApp activateIgnoringOtherApps:YES];
glGenBuffers(n, vbo);
checkError("glGenBuffers");
//[m_internalData->m_window setLevel:NSMainMenuWindowLevel];