fix retina API

This commit is contained in:
Erwin Coumans
2015-08-07 16:21:33 -07:00
parent 3c0e67298a
commit edaa92c286
8 changed files with 18 additions and 7 deletions

View File

@@ -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);

View File

@@ -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];
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);
};

View File

@@ -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();