bool wxGLCanvasBase::SetCurrent(const wxGLContext& context) const { // although on MSW it works even if the window is still hidden, it doesn't // work in other ports (notably X11-based ones) and documentation mentions // that SetCurrent() can only be called for a shown window, so check for it wxASSERT_MSG( IsShown(), wxT("can't make hidden GL canvas current") ); return context.SetCurrent(*static_cast<const wxGLCanvas *>(this)); }
MainFrame(wxApp& app, const wxString& example_name) : wxFrame( (wxWindow*)0, wxID_ANY, wxT("OGLplus example"), wxDefaultPosition, wxSize(300, 600)) , status_bar(new wxStatusBar(this)) , tmp_canvas(new wxGLCanvas( (wxWindow*)this, wxID_ANY, GLConfig(), wxDefaultPosition, wxDefaultSize)) , gl_context(tmp_canvas) , api_init(nullptr) , example_frame(nullptr) { InitComponents(example_name); Show(); SetStatus(wxT("Initializing GL")); gl_context.SetCurrent(*tmp_canvas); api_init = new oglplus::GLAPIInitializer(); delete tmp_canvas; SetStatus(wxT("Ready")); Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(MainFrame::OnClose)); example_frame = new ExampleFrame( app, (wxWindow*)this, example_name, (ExampleInfoDisplay*)this, &gl_context); SetStatus(wxT("Running")); }
void wxGLCanvas::SetCurrent(const wxGLContext& RC) const { RC.SetCurrent(*this); }