ExampleOpenGLCanvasBase.cpp
Implement a simple example for the OpenGLCanvasBase canvas. Please note the specialized canvases liek the OpenGLCanvas (without
Base) or the ImageCanvasGL which may be a betetr choice for you.
- Author:
- Jan Woetzel
#include "ExampleOpenGLCanvasBase.hh"
#include <Gui/ConsoleRedirectIO.hh>
using namespace std;
IMPLEMENT_APP(ExampleOpenGLCanvasApp)
bool ExampleOpenGLCanvasApp::OnInit()
{
ConsoleRedirectIO();
cout<<"Hallo cout"<<endl;
cout<<"Hallo cerr"<<endl;
MyFrame *frame = new MyFrame( wxT("ExampleOpenGLCanvasBase"), wxPoint(0,0), wxSize(640,480) );
frame->Show(TRUE);
wxLogGui log;
SetTopWindow(frame);
return TRUE;
}
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_QUIT, MyFrame::OnQuit)
EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
END_EVENT_TABLE()
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
,p_canvas(NULL)
{
wxMenu *menuFile = new wxMenu;
menuFile->Append( ID_ABOUT, wxT("&About...") );
menuFile->AppendSeparator();
menuFile->Append( ID_QUIT, wxT("E&xit") );
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, wxT("&File"));
SetMenuBar(menuBar);
CreateStatusBar(3);
p_canvas=new BIAS::OpenGLCanvasBase(this, -1);
}
void MyFrame::OnQuit(wxCommandEvent& ){
Close(TRUE);
}
void MyFrame::OnAbout(wxCommandEvent& )
{
wxString title(wxT("About"));
wxString msg;
msg<<wxT("About - ")<<AsciiToWx(FUNCNAME)<<wxT("\n");
msg<<wxT("author: Jan Woetzel (c) 2003-2005\n");
msg<<wxT("build: ")<<AsciiToWx(__DATE__)<<wxT(" ")<<AsciiToWx(__TIME__)<<wxT("\n");
msg<<wxT("from ")<<AsciiToWx(__FILE__)<<wxT("\n");
msg<<wxT("GUI using: ")<<wxVERSION_STRING<<wxT("\n");
msg<<wxT("\n");
COUT(msg);
wxMessageBox(msg, title, wxICON_INFORMATION | wxOK );
}