Fix creating wxGLCanvas with NULL attributes list
Using NULL attributes list was not the same as using default wxGLAttributes, but used a platform-dependent set of attributes that was traditionally used by old wxWidgets versions for compatibility. However these attributes didn't specify some important attributes, notably depth buffer size, and relied on OpenGL driver using some reasonable defaults, but this turns out to not be the case any more and resulted in not enabling depth buffer at all, see #22787. Fix this by using the same default attributes as were already used by wxGLAttributes::Defaults() in this case, as this is much more useful, even if not 100%-compatible with the old behaviour. See #22828.
This commit is contained in:
parent
0e23fa04b4
commit
e11ea1b737
7 changed files with 1 additions and 40 deletions
|
|
@ -161,11 +161,6 @@ public:
|
|||
wxGLAttributes& Samplers(int val);
|
||||
wxGLAttributes& FrameBuffersRGB();
|
||||
void EndList(); // No more values can be chained
|
||||
|
||||
// This function is undocumented and cannot be chained on purpose!
|
||||
// To keep backwards compatibility with versions before wx3.1 we add here
|
||||
// the default values used in those versions for the case of NULL list.
|
||||
void AddDefaultsForWXBefore31();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -158,8 +158,7 @@ bool wxGLCanvasBase::ParseAttribList(const int *attribList,
|
|||
|
||||
if ( !attribList )
|
||||
{
|
||||
// Default visual attributes used in wx versions before wx3.1
|
||||
dispAttrs.AddDefaultsForWXBefore31();
|
||||
dispAttrs.Defaults();
|
||||
dispAttrs.EndList();
|
||||
if ( ctxAttrs )
|
||||
ctxAttrs->EndList();
|
||||
|
|
|
|||
|
|
@ -537,12 +537,6 @@ wxGLAttributes& wxGLAttributes::Defaults()
|
|||
return *this;
|
||||
}
|
||||
|
||||
void wxGLAttributes::AddDefaultsForWXBefore31()
|
||||
{
|
||||
// ParseAttribList() will add EndList(), don't do it now
|
||||
RGBA().DoubleBuffer().Depth(16);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGLContext
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -356,14 +356,6 @@ wxGLAttributes& wxGLAttributes::Defaults()
|
|||
return *this;
|
||||
}
|
||||
|
||||
void wxGLAttributes::AddDefaultsForWXBefore31()
|
||||
{
|
||||
// ParseAttribList() will add EndList(), don't do it now
|
||||
DoubleBuffer();
|
||||
// Negative value will keep its buffer untouched
|
||||
BufferSize(8).Depth(8).MinRGBA(-1, -1, -1, 0);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGLContext
|
||||
|
|
|
|||
|
|
@ -327,10 +327,6 @@ wxGLAttributes& wxGLAttributes::Defaults()
|
|||
return *this;
|
||||
}
|
||||
|
||||
void wxGLAttributes::AddDefaultsForWXBefore31()
|
||||
{
|
||||
Defaults();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// wxGlContext
|
||||
|
|
|
|||
|
|
@ -275,12 +275,6 @@ wxGLAttributes& wxGLAttributes::Defaults()
|
|||
return *this;
|
||||
}
|
||||
|
||||
void wxGLAttributes::AddDefaultsForWXBefore31()
|
||||
{
|
||||
// ParseAttribList() will add EndList(), don't do it now
|
||||
DoubleBuffer();
|
||||
}
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// wxGLContext implementation
|
||||
|
|
|
|||
|
|
@ -433,15 +433,6 @@ wxGLAttributes& wxGLAttributes::Defaults()
|
|||
return *this;
|
||||
}
|
||||
|
||||
void wxGLAttributes::AddDefaultsForWXBefore31()
|
||||
{
|
||||
// ParseAttribList() will add EndList(), don't do it now
|
||||
DoubleBuffer();
|
||||
if ( wxGLCanvasX11::GetGLXVersion() < 13 )
|
||||
RGBA().Depth(1).MinRGBA(1, 1, 1, 0);
|
||||
// For GLX >= 1.3 its defaults (GLX_RGBA_BIT and GLX_WINDOW_BIT) are OK
|
||||
}
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// wxGLContext implementation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue