X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be5a51fb592f3fa2ba38ac6cd1e488d6d806058c..8829531cdbc850cb9d6221e517edef26df8ebcee:/samples/opengl/isosurf/isosurf.cpp diff --git a/samples/opengl/isosurf/isosurf.cpp b/samples/opengl/isosurf/isosurf.cpp index 1489b7f958..781d2a8a16 100644 --- a/samples/opengl/isosurf/isosurf.cpp +++ b/samples/opengl/isosurf/isosurf.cpp @@ -9,11 +9,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation -#pragma interface -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -25,10 +20,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 @@ -49,9 +49,9 @@ #include "isosurf.h" -// The following part is taken largely unchanged from the original C Version +#include "../../sample.xpm" -#include +// The following part is taken largely unchanged from the original C Version GLboolean speed_test = GL_FALSE; GLboolean use_vertex_arrays = GL_FALSE; @@ -272,7 +272,7 @@ bool MyApp::OnInit() int gl_attrib[20] = { WX_GL_RGBA, WX_GL_MIN_RED, 1, WX_GL_MIN_GREEN, 1, WX_GL_MIN_BLUE, 1, WX_GL_DEPTH_SIZE, 1, WX_GL_DOUBLEBUFFER, -# ifdef __WXMAC__ +# if defined(__WXMAC__) || defined(__WXCOCOA__) GL_NONE }; # else None }; @@ -288,8 +288,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 +300,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 +311,13 @@ 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 + SetIcon(wxIcon(sample_xpm)); } MyFrame::~MyFrame() { -#if wxUSE_GLCANVAS - if (m_canvas) - { - delete m_canvas; m_canvas = NULL; - } -#endif + delete m_canvas; } // Intercept menu commands @@ -346,8 +331,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) @@ -359,7 +342,7 @@ END_EVENT_TABLE() TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name, int* gl_attrib) - : wxGLCanvas(parent, id, pos, size, style, name, gl_attrib) + : wxGLCanvas(parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name, gl_attrib) { parent->Show(true); SetCurrent(); @@ -373,10 +356,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 +476,3 @@ void TestGLCanvas::OnEraseBackground( wxEraseEvent& WXUNUSED(event) ) // Do nothing, to avoid flashing. } -#endif // #if wxUSE_GLCANVAS -