* wxGLCanvas implementation
*/
-IMPLEMENT_CLASS(wxGLCanvas, wxScrolledWindow)
+IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
-BEGIN_EVENT_TABLE(wxGLCanvas, wxScrolledWindow)
+BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow)
EVT_SIZE(wxGLCanvas::OnSize)
END_EVENT_TABLE()
int *attribList, const wxPalette& palette)
{
m_macEraseOnRedraw = false ;
- wxScrolledWindow::Create( parent, id, pos, size, style, name );
+ wxWindow::Create( parent, id, pos, size, style, name );
AGLPixelFormat fmt = ChoosePixelFormat(attribList);
wxCHECK_MSG( fmt, false, wxT("Couldn't create OpenGl pixel format") );
}
void wxGLCanvas::OnSize(wxSizeEvent& event)
+{
+ MacUpdateView() ;
+}
+
+void wxGLCanvas::MacUpdateView()
{
if (m_glContext)
{
UpdateContext();
m_glContext->SetCurrent();
-
SetViewport();
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
- glMatrixMode(GL_MODELVIEW);
}
}
+void wxGLCanvas::MacSuperChangedPosition()
+{
+ MacUpdateView() ;
+ wxWindow::MacSuperChangedPosition() ;
+}
+
+void wxGLCanvas::MacTopLevelWindowChangedPosition()
+{
+ MacUpdateView() ;
+ wxWindow::MacTopLevelWindowChangedPosition() ;
+}
+
void wxGLCanvas::SetCurrent()
{
if (m_glContext)
bool wxGLApp::InitGLVisual(int *attribList)
{
AGLPixelFormat fmt = ChoosePixelFormat(attribList);
- return (fmt != NULL);
+ if (fmt != NULL) {
+ aglDestroyPixelFormat(fmt);
+ return true;
+ } else
+ return false;
}
wxGLApp::~wxGLApp(void)