X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/378a3872eb0bfaaff6f32144ddef0dd144b056b2..51146826fc0a0a949d88f23fb9d83fc1f1ada14e:/samples/opengl/cube/cube.cpp diff --git a/samples/opengl/cube/cube.cpp b/samples/opengl/cube/cube.cpp index 6a5bc37778..411979b571 100644 --- a/samples/opengl/cube/cube.cpp +++ b/samples/opengl/cube/cube.cpp @@ -146,6 +146,8 @@ TestGLContext& MyApp::GetContext(wxGLCanvas *canvas) { if ( !m_glContext ) m_glContext = new TestGLContext(canvas); + else + m_glContext->SetCurrent(*canvas); return *m_glContext; } @@ -165,6 +167,10 @@ TestGLContext::TestGLContext(wxGLCanvas *canvas) glEnable(GL_LIGHT0); glEnable(GL_TEXTURE_2D); + // add slightly more light, the default lightning is rather dark + GLfloat ambient[] = { 0.5, 0.5, 0.5, 0.5 }; + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + // set viewing projection glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -298,7 +304,7 @@ void TestGLCanvas::OnSize(wxSizeEvent& event) // don't prevent default processing from taking place event.Skip(); - if ( !IsShown() ) + if ( !IsShownOnScreen() ) return; // set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)