Refactor Unix OpenGL code to avoid using static attributes array.

Put the context attributes in wxGLCanvasX11 itself instead.

See #16402.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77073 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-08-15 12:14:11 +00:00
parent 74421a7f35
commit a4606fbb44
2 changed files with 75 additions and 38 deletions

View File

@@ -72,6 +72,13 @@ public:
virtual Window GetXWindow() const = 0;
// GLX-specific methods
// --------------------
// return attribs for glXCreateContextAttribsARB
const int *GetGLXContextAttribs() const { return m_glxContextAttribs; }
// override some wxWindow methods
// ------------------------------
@@ -105,8 +112,13 @@ public:
GLXFBConfig **pFBC, XVisualInfo **pXVisual);
private:
// initializes glxContextAttribs as defined by wxattrs which must be
// 0-terminated
static void InitGLXContextAttribs(const int *wxattrs, int *glxctxattribs);
// fills in glattrs with attributes defined by wxattrs which must be
// 0-terminated if it is non-NULL
// will ignore any gl context attribs
//
// n is the max size of glattrs, false is returned if we overflow it, it
// should be at least 16 to accommodate the default attributes
@@ -122,6 +134,10 @@ private:
// the global/default versions of the above
static GLXFBConfig *ms_glFBCInfo;
static XVisualInfo *ms_glVisualInfo;
// max 8 attributes plus terminator
// if first is 0, create legacy context
int m_glxContextAttribs[9];
};
// ----------------------------------------------------------------------------