#include "cube.h"
-// This statement initializes the whole application and calls OnInit
-MyApp myApp;
-
-IMPLEMENT_APP(MyApp)
-
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit(void)
{
frame->m_canvas = new TestGLCanvas(frame, -1, wxPoint(0, 0), wxSize(200, 200));
- InitGL();
+// InitGL();
// Show the frame
frame->Show(TRUE);
glEnable(GL_LIGHT0);
}
+IMPLEMENT_APP(MyApp)
+
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
END_EVENT_TABLE()
void TestGLCanvas::OnPaint( wxPaintEvent& event )
{
+ // This is a dummy, to avoid an endless succession of paint messages.
+ // OnPaint handlers must always create a wxPaintDC.
+ wxPaintDC dc(this);
+
if ( !GetContext() )
return;
int width, height;
GetClientSize(& width, & height);
- if ( GetContext() )
+ if (GetContext())
+ {
+ SetCurrent();
glViewport(0, 0, width, height);
+ }
}
void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)