1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
Description: wxWidgets 3.2 compatibility
Bug-Debian: https://bugs.debian.org/1019819
Forwarded: no
Author: Scott Talbert <swt@techie.net>
Last-Update: 2022-10-23
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -625,14 +625,16 @@ END_EVENT_TABLE()
TestGLCanvas::TestGLCanvas(wxWindow *_parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name)
- : wxGLCanvas(_parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name)
+ : wxGLCanvas(_parent, id, NULL, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name)
{
initdone=false;
shownHQ=false;
+ m_glRC = new wxGLContext(this);
}
TestGLCanvas::~TestGLCanvas()
{
+ delete m_glRC;
}
@@ -660,11 +662,7 @@ void TestGLCanvas::OnPaint( wxPaintEvent
/* must always be here */
wxPaintDC dc(this);
-#ifndef __WXMOTIF__
- if (!GetContext()) return;
-#endif
-
- SetCurrent();
+ SetCurrent(*m_glRC);
if (!initdone) {
static bool once=false;
@@ -702,18 +700,12 @@ void TestGLCanvas::OnPaint( wxPaintEvent
void TestGLCanvas::OnSize(wxSizeEvent& event)
{
- // this is also necessary to update the context on some platforms
- wxGLCanvas::OnSize(event);
-
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
GetClientSize(&winx, &winy);
mainCanvas.SetVideoSize(winx);
-#ifndef __WXMOTIF__
- if ( GetContext() )
-#endif
{
- SetCurrent();
+ SetCurrent(*m_glRC);
glViewport(0, 0, (GLint) winx, (GLint) winy);
}
}
--- a/src/main.h
+++ b/src/main.h
@@ -141,6 +141,7 @@ public:
private:
//wxWindow *parent;
+ wxGLContext *m_glRC;
DECLARE_EVENT_TABLE()
};
|