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
/** Simple example for BIAS::OpenGLCanvas(Base) usage.
@author: Jan Woetzel */

//#include <Base/Common/LeakChecking.h>

#include "ExampleOpenGLCanvasBase.hh"

// BIAS
#include <Gui/ConsoleRedirectIO.hh>

using namespace std;

// required for wx RTTI dynamic construction: 
IMPLEMENT_APP(ExampleOpenGLCanvasApp)


// --------------------------------------------------------
bool ExampleOpenGLCanvasApp::OnInit()
{
    // utility: create a Redirection console for cout, cerr etc.
    ConsoleRedirectIO();
    // testing output: 
    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)
{
    // Create a simple top Menu
    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);

    // Create a simple bottom status bar 
    CreateStatusBar(3);

    // Canvas to test: 
    p_canvas=new BIAS::OpenGLCanvasBase(this, -1);

}


void MyFrame::OnQuit(wxCommandEvent& ){ 
    Close(TRUE); 
}


void MyFrame::OnAbout(wxCommandEvent& )
{
    wxString title(wxT("About"));
    wxString msg; // message
    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 );
}


Generated on Sat Mar 13 01:02:28 2010 for Basic Image AlgorithmS Library by  doxygen 1.5.6