00001 00002 00023 #ifndef _vuGLCanvas_h_ 00024 #define _vuGLCanvas_h_ 00025 00026 #include <wx/glcanvas.h> 00027 00028 class vuGLCanvas : public wxGLCanvas 00029 { 00030 public: 00032 00045 vuGLCanvas(wxWindow *parent, const wxWindowID id = -1, 00046 const wxPoint& pos = wxDefaultPosition, 00047 const wxSize& size = wxDefaultSize, long style = 0, 00048 const wxString& name = "vuGLCanvas", int* gl_attrib = NULL); 00049 00051 00054 void redraw(); 00055 00057 int getWidth() const; 00059 int getHeight() const; 00060 00062 00065 void enableOpenGL(); 00066 00068 00074 void disableOpenGL(); 00075 00076 protected: 00077 00079 00085 virtual bool glInit() { return true; }; 00086 00088 00099 virtual void render() {}; 00100 00102 00109 virtual void resize() {}; 00110 00111 private: 00113 00118 void onPaint(wxPaintEvent& event); 00119 00121 00127 void onSize(wxSizeEvent& event); 00128 00130 00135 void onEraseBackground(wxEraseEvent &event); 00136 00137 private: 00139 int m_Width; 00141 int m_Height; 00143 bool m_init; 00145 bool m_useOGL; 00146 00147 DECLARE_EVENT_TABLE() 00148 }; 00149 00150 #endif