4 #include <bias_config.h>
8 #include "ExampleOpenGLCanvas.hh"
11 #include <Gui/ConsoleRedirectIO.hh>
12 #include <Gui/GeometryGL.hh>
17 IMPLEMENT_APP(ExampleOpenGLCanvasApp)
21 # define GLUT_BUILDING_LIB
23 # include <GLUT/glut.h>
27 #endif // BIAS_HAVE_GLUT
34 MyGLCanvas::MyGLCanvas(wxFrame* parent)
42 void MyGLCanvas::DisplayCalls()
50 glClearColor(0.3,0.1,0.1,0);
51 glClear(GL_COLOR_BUFFER_BIT);
52 glMatrixMode(GL_MODELVIEW);
91 glColor3f(0.8,0.0,0.8);
93 #endif // BIAS_HAVE_GLUT
95 this->DisplayCoordCross();
101 this->GetViewController().GetExternals().DisplayViewAt();
130 bool ExampleOpenGLCanvasApp::OnInit()
135 cout<<
"Hello cout"<<endl;
136 cout<<
"Hello cerr"<<endl;
138 MyFrame *frame =
new MyFrame( wxT(
"ExampleOpenGLCanvas"), wxPoint(0,0), wxSize(640,480) );
147 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
148 EVT_MENU(ID_QUIT, MyFrame::OnQuit)
149 EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
150 EVT_MENU(ID_TESTSHOT, MyFrame::OnTestShot)
155 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
156 : wxFrame((wxFrame *)NULL, -1, title, pos, size)
160 wxMenu *menuFile =
new wxMenu;
161 menuFile->Append( ID_ABOUT, wxT(
"&About...") );
162 menuFile->AppendSeparator();
163 menuFile->Append( ID_TESTSHOT, wxT(
"&Shot...\tCtrl-S") );
164 menuFile->AppendSeparator();
165 menuFile->Append( ID_QUIT, wxT(
"E&xit") );
167 wxMenuBar *menuBar =
new wxMenuBar;
168 menuBar->Append(menuFile, wxT(
"&File"));
176 p_canvas=
new MyGLCanvas(
this);
182 void MyFrame::OnTestShot(wxCommandEvent& )
184 p_canvas->ScreenShot(
"out_RGB.jpg",
true, GL_RGB);
186 p_canvas->ScreenShot(
"out_RGB.mip",
true, GL_RGB);
187 p_canvas->ScreenShot(
"out_RGBA.mip",
true, GL_RGBA);
188 p_canvas->ScreenShot(
"out_DEPTH.mip",
true, GL_DEPTH_COMPONENT);
189 p_canvas->ScreenShot(
"out_DEPTH.jpg",
true, GL_DEPTH_COMPONENT);
190 p_canvas->ScreenShot(
"out_ALPHA.mip",
true, GL_ALPHA);
191 p_canvas->ScreenShot(
"out_ALPHA.jpg",
true, GL_ALPHA);
192 p_canvas->ScreenShot(
"out_LUMINANCE.mip",
true, GL_LUMINANCE);
193 p_canvas->ScreenShot(
"out_STENCIL.mip",
true, GL_STENCIL_INDEX);
197 void MyFrame::OnQuit(wxCommandEvent& ){
202 void MyFrame::OnAbout(wxCommandEvent& )
204 wxString title(wxT(
"About"));
206 msg<<wxT(
"About - ")<<
AsciiToWx(FUNCNAME)<<wxT(
"\n");
207 msg<<wxT(
"author: Jan Woetzel (c) 2003-2005\n");
209 msg<<wxT(
"from ")<<
AsciiToWx(__FILE__)<<wxT(
"\n");
210 msg<<wxT(
"GUI using: ")<<wxVERSION_STRING<<wxT(
"\n");
213 wxMessageBox(msg, title, wxICON_INFORMATION | wxOK );
void BIASGui_EXPORT ConsoleRedirectIO(std::string name=std::string(""))
Extra Console for WIN32 WinMain gui applications.
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
OpenGL canvases with additinal event handling (JW)
const int attribsRGBASD[]
helper to simplify setting up format "red,green,blue,alpha,stencil,depth" JW to be used as (int*)...