diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-04-18 01:10:47 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-09-27 13:41:46 +0200 |
| commit | 486c4d7825a151dcf00e3504a8195bff8afddcb3 (patch) | |
| tree | 7989b4c1d9b133dd44069546b7ad6491fc842a00 /hacks/gl/shader.cc | |
| parent | dcd9afacd67975a9e20a6d1c4b3998c2890f1c16 (diff) | |
Add some OpenGL-related notes and hacks.
Diffstat (limited to 'hacks/gl/shader.cc')
| -rw-r--r-- | hacks/gl/shader.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/hacks/gl/shader.cc b/hacks/gl/shader.cc new file mode 100644 index 000000000..8d5f5fe70 --- /dev/null +++ b/hacks/gl/shader.cc @@ -0,0 +1,50 @@ +#include <wx/wx.h> +#include <wx/glcanvas.h> + + + +class GLCanvas +{ +public: + GLCanvas (wxFrame* parent) + { + _canvas = new wxGLCanvas(parent); + Bind(wxEVT_PAINT, bind(&GLCanvas::paint, this); + } + + wxWindow* get() + { + return _canvas; + } + + void paint() + { + + } + + +private: + wxGLCanvas* _canvas; +}; + + + +class MyApp : public wxApp +{ +public: + bool OnInit() + { + auto sizer = new wxBoxSizer(wxHORIZONTAL); + _frame = new wxFrame(nullptr, wxID_ANY, wxT("Hello world")); + _canvas = new GLCanvas(_frame); + sizer->Add(_canvas->get(), 1, wxEXPAND); + _frame->SetSizerAndFit(sizer); + _frame->Show(); + return true; + } + +private: + wxFrame* _frame; + GLCanvas* _canvas; +}; + |
