commit a348fd95102a26b9b1728f497799be1dd4b4a7a9
Author: Bernhard Stegmaier <stegmaier@sw-systems.de>
Date:   Sat Feb 13 20:23:02 2016 +0100

    OSX: Add Retina support to 3d-viewer similar to OpenGL canvas

diff --git a/3d-viewer/3d_canvas.cpp b/3d-viewer/3d_canvas.cpp
index f1139f0..563adb5 100644
--- a/3d-viewer/3d_canvas.cpp
+++ b/3d-viewer/3d_canvas.cpp
@@ -107,6 +107,10 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
     // Explicitly create a new rendering context instance for this canvas.
     m_glRC = new wxGLContext( this );
 
+#ifdef RETINA_OPENGL_PATCH
+    SetViewWantsBestResolution( true );
+#endif
+
     DisplayStatus();
 }
 
diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp
index 1a7a97b..5647114 100644
--- a/3d-viewer/3d_draw.cpp
+++ b/3d-viewer/3d_draw.cpp
@@ -108,7 +108,7 @@ void EDA_3D_CANVAS::create_and_render_shadow_buffer( GLuint *aDst_gl_texture,
 {
     glDisable( GL_TEXTURE_2D );
 
-    glViewport( 0, 0, aTexture_size, aTexture_size);
+    glViewport( 0, 0, aTexture_size, aTexture_size );
 
     glClearColor( 1.0f, 1.0f, 1.0f, 1.0f );
     glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
@@ -231,7 +231,13 @@ void EDA_3D_CANVAS::generateFakeShadowsTextures( REPORTER* aErrorMessages, REPOR
                   -GetPrm3DVisu().m_BoardPos.y * GetPrm3DVisu().m_BiuTo3Dunits,
                   0.0f );
 
-    create_and_render_shadow_buffer( &m_text_fake_shadow_front, 512, false, 1 );
+#ifdef RETINA_OPENGL_PATCH
+    const GLuint texture_size = (GLuint) ( 512.0 * GetBackingScaleFactor() );
+#else
+    const GLuint texture_size = 512;
+#endif
+
+    create_and_render_shadow_buffer( &m_text_fake_shadow_front, texture_size, false, 1 );
 
     zpos = GetPrm3DVisu().GetLayerZcoordBIU( B_Paste ) * GetPrm3DVisu().m_BiuTo3Dunits;
 
@@ -246,7 +252,7 @@ void EDA_3D_CANVAS::generateFakeShadowsTextures( REPORTER* aErrorMessages, REPOR
                   -GetPrm3DVisu().m_BoardPos.y * GetPrm3DVisu().m_BiuTo3Dunits,
                   0.0f );
 
-    create_and_render_shadow_buffer( &m_text_fake_shadow_back, 512, false, 1 );
+    create_and_render_shadow_buffer( &m_text_fake_shadow_back, texture_size, false, 1 );
 
 
     // Render ALL BOARD shadow
@@ -281,7 +287,7 @@ void EDA_3D_CANVAS::generateFakeShadowsTextures( REPORTER* aErrorMessages, REPOR
     // move the bouding box in order to draw it with its center at 0,0 3D coordinates
     glTranslatef( -(m_fastAABBox_Shadow.Min().x + v.x / 2.0f), -(m_fastAABBox_Shadow.Min().y + v.y / 2.0f), 0.0f );
 
-    create_and_render_shadow_buffer( &m_text_fake_shadow_board, 512, true, 10 );
+    create_and_render_shadow_buffer( &m_text_fake_shadow_board, texture_size, true, 10 );
 
     DBG( printf( "  generateFakeShadowsTextures total time %f ms\n", (double) (GetRunningMicroSecs() - strtime) / 1000.0 ) );
 }
@@ -318,7 +324,12 @@ void EDA_3D_CANVAS::Redraw()
     }
 
     // *MUST* be called *after*  SetCurrent( ):
-    glViewport( 0, 0, size.x, size.y );
+#ifdef RETINA_OPENGL_PATCH
+    const float scale_factor = GetBackingScaleFactor();
+#else
+    const float scale_factor = 1.0f;
+#endif
+    glViewport( 0, 0, size.x * scale_factor, size.y * scale_factor );
 
     // clear color and depth buffers
     glClearColor( 0.95, 0.95, 1.0, 1.0 );
