diff --git a/examples/CommonInterfaces/CommonWindowInterface.h b/examples/CommonInterfaces/CommonWindowInterface.h index f94189c00..fb3b574e9 100644 --- a/examples/CommonInterfaces/CommonWindowInterface.h +++ b/examples/CommonInterfaces/CommonWindowInterface.h @@ -118,6 +118,8 @@ class CommonWindowInterface virtual void setWindowTitle(const char* title)=0; virtual float getRetinaScale() const =0; + virtual void setAllowRetina(bool allow) =0; + virtual int fileOpenDialog(char* fileName, int maxFileNameLength) = 0; diff --git a/examples/ExampleBrowser/OpenGLExampleBrowser.cpp b/examples/ExampleBrowser/OpenGLExampleBrowser.cpp index b4c3f3c2f..82dec4687 100644 --- a/examples/ExampleBrowser/OpenGLExampleBrowser.cpp +++ b/examples/ExampleBrowser/OpenGLExampleBrowser.cpp @@ -715,7 +715,7 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[]) { char title[1024]; sprintf(title,"%s using OpenGL3+. %s", appTitle,optMode); - simpleApp = new SimpleOpenGL3App(title,width,height); + simpleApp = new SimpleOpenGL3App(title,width,height, gAllowRetina); s_app = simpleApp; } #endif diff --git a/examples/OpenGLWindow/MacOpenGLWindow.h b/examples/OpenGLWindow/MacOpenGLWindow.h index 29204b260..f17102a8b 100644 --- a/examples/OpenGLWindow/MacOpenGLWindow.h +++ b/examples/OpenGLWindow/MacOpenGLWindow.h @@ -19,6 +19,8 @@ class MacOpenGLWindow : public CommonWindowInterface b3RenderCallback m_renderCallback; float m_retinaScaleFactor; + bool m_allowRetina; + public: MacOpenGLWindow(); @@ -89,6 +91,10 @@ public: { return m_retinaScaleFactor; } + virtual void setAllowRetina(bool allow) + { + m_allowRetina = allow; + } virtual void createWindow(const b3gWindowConstructionInfo& ci); diff --git a/examples/OpenGLWindow/MacOpenGLWindow.mm b/examples/OpenGLWindow/MacOpenGLWindow.mm index 3bb3f2559..6bc0dc056 100644 --- a/examples/OpenGLWindow/MacOpenGLWindow.mm +++ b/examples/OpenGLWindow/MacOpenGLWindow.mm @@ -39,7 +39,6 @@ void dumpInfo(void) -extern bool gAllowRetina; // -------------------- View ------------------------ @@ -233,7 +232,8 @@ m_mouseMoveCallback(0), m_mouseButtonCallback(0), m_wheelCallback(0), m_keyboardCallback(0), -m_retinaScaleFactor(1) +m_retinaScaleFactor(1), +m_allowRetina(true) { } @@ -398,7 +398,7 @@ void MacOpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci) //support HighResolutionOSX for Retina Macbook if (ci.m_openglVersion>=3) { - if (gAllowRetina) + if (m_allowRetina) { [m_internalData->m_myview setWantsBestResolutionOpenGLSurface:YES]; } diff --git a/examples/OpenGLWindow/SimpleOpenGL3App.cpp b/examples/OpenGLWindow/SimpleOpenGL3App.cpp index a5fda66ba..67dfa0953 100644 --- a/examples/OpenGLWindow/SimpleOpenGL3App.cpp +++ b/examples/OpenGLWindow/SimpleOpenGL3App.cpp @@ -112,7 +112,7 @@ static GLuint BindFont(const CTexFont *_Font) extern unsigned char OpenSansData[]; -SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height) +SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height, bool allowRetina) { gApp = this; m_data = new SimpleInternalData; @@ -123,6 +123,8 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height) m_data->m_upAxis = 1; m_window = new b3gDefaultOpenGLWindow(); + m_window->setAllowRetina(allowRetina); + b3gWindowConstructionInfo ci; ci.m_title = title; ci.m_width = width; diff --git a/examples/OpenGLWindow/SimpleOpenGL3App.h b/examples/OpenGLWindow/SimpleOpenGL3App.h index 64123c36e..15fee8ab5 100644 --- a/examples/OpenGLWindow/SimpleOpenGL3App.h +++ b/examples/OpenGLWindow/SimpleOpenGL3App.h @@ -16,7 +16,7 @@ struct SimpleOpenGL3App : public CommonGraphicsApp class GLInstancingRenderer* m_instancingRenderer; virtual void setBackgroundColor(float red, float green, float blue); - SimpleOpenGL3App(const char* title, int width,int height); + SimpleOpenGL3App(const char* title, int width,int height, bool allowRetina); virtual ~SimpleOpenGL3App(); virtual int registerCubeShape(float halfExtentsX=1.f,float halfExtentsY=1.f, float halfExtentsZ = 1.f, int textureIndex = -1); diff --git a/examples/OpenGLWindow/Win32OpenGLWindow.h b/examples/OpenGLWindow/Win32OpenGLWindow.h index 41f42d956..bf8a0f5eb 100644 --- a/examples/OpenGLWindow/Win32OpenGLWindow.h +++ b/examples/OpenGLWindow/Win32OpenGLWindow.h @@ -51,6 +51,7 @@ public: virtual void endRendering(); virtual float getRetinaScale() const {return 1.f;} + virtual void setAllowRetina(bool /*allowRetina*/) {}; virtual int fileOpenDialog(char* fileName, int maxFileNameLength); }; diff --git a/examples/OpenGLWindow/X11OpenGLWindow.h b/examples/OpenGLWindow/X11OpenGLWindow.h index fd8fc6127..cc28aae1a 100644 --- a/examples/OpenGLWindow/X11OpenGLWindow.h +++ b/examples/OpenGLWindow/X11OpenGLWindow.h @@ -39,7 +39,7 @@ public: virtual void endRendering(); virtual float getRetinaScale() const {return 1.f;} - + virtual void setAllowRetina(bool /*allowRetina*/) {}; virtual void runMainLoop(); virtual float getTimeInSeconds();