X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5cf036d017b19e9447e52e271c4afac2109ffcd3..2bacc6ab950485e4b7e58ce6be0639ff5a936835:/samples/opengl/isosurf/isosurf.cpp?ds=sidebyside diff --git a/samples/opengl/isosurf/isosurf.cpp b/samples/opengl/isosurf/isosurf.cpp index 3eda7123bb..95485de92d 100644 --- a/samples/opengl/isosurf/isosurf.cpp +++ b/samples/opengl/isosurf/isosurf.cpp @@ -25,10 +25,15 @@ #include "wx/wx.h" #endif +#if !wxUSE_GLCANVAS + #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library" +#endif + #include "wx/timer.h" #include "wx/glcanvas.h" +#include "wx/math.h" -#ifdef __WXMAC__ +#if defined(__WXMAC__) || defined(__WXCOCOA__) # ifdef __DARWIN__ # include # include @@ -51,8 +56,6 @@ // The following part is taken largely unchanged from the original C Version -#include - GLboolean speed_test = GL_FALSE; GLboolean use_vertex_arrays = GL_FALSE; @@ -238,7 +241,7 @@ static GLenum Args(int argc, wxChar **argv) return GL_TRUE; } -// The following part was written for wxWindows 1.66 +// The following part was written for wxWidgets 1.66 MyFrame *frame = NULL; IMPLEMENT_APP(MyApp) @@ -249,7 +252,7 @@ bool MyApp::OnInit() Args(argc, argv); // Create the main frame window - frame = new MyFrame(NULL, wxT("wxWindows OpenGL Isosurf Sample"), + frame = new MyFrame(NULL, wxT("wxWidgets OpenGL Isosurf Sample"), wxDefaultPosition, wxDefaultSize); // Give it an icon @@ -288,8 +291,6 @@ bool MyApp::OnInit() doubleBuffer = GL_FALSE; } -#if wxUSE_GLCANVAS - frame->m_canvas = new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, _T("TestGLCanvas"), gl_attrib ); @@ -302,13 +303,6 @@ bool MyApp::OnInit() Init(); return true; - -#else - - wxMessageBox( _T("This sample has to be compiled with wxUSE_GLCANVAS"), _T("Building error"), wxOK); - - return false; -#endif } BEGIN_EVENT_TABLE(MyFrame, wxFrame) @@ -320,19 +314,12 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(frame, wxID_ANY, title, pos, size, style) { -#if wxUSE_GLCANVAS m_canvas = NULL; -#endif } MyFrame::~MyFrame() { -#if wxUSE_GLCANVAS - if (m_canvas) - { - delete m_canvas; m_canvas = NULL; - } -#endif + delete m_canvas; } // Intercept menu commands @@ -346,8 +333,6 @@ void MyFrame::OnExit( wxCommandEvent& WXUNUSED(event) ) * TestGLCanvas implementation */ -#if wxUSE_GLCANVAS - BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas) EVT_SIZE(TestGLCanvas::OnSize) EVT_PAINT(TestGLCanvas::OnPaint) @@ -373,10 +358,6 @@ TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id, } -TestGLCanvas::~TestGLCanvas() -{ -} - void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) ) { // This is a dummy, to avoid an endless succession of paint messages. @@ -497,5 +478,3 @@ void TestGLCanvas::OnEraseBackground( wxEraseEvent& WXUNUSED(event) ) // Do nothing, to avoid flashing. } -#endif // #if wxUSE_GLCANVAS -