mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
better fix for previously named problem
This commit is contained in:
parent
1feec43b43
commit
10511a4246
@ -166,19 +166,28 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
|||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
int num_configs = 0;
|
// First get the number of matching configurations, so we know how much memory to allocate.
|
||||||
EGLConfig configs[256];
|
int num_configs = 0, returned_configs;
|
||||||
if (!eglChooseConfig(_egl_display, attrib_list, configs, 256, &num_configs) || num_configs <= 0) {
|
if (!eglChooseConfig(_egl_display, attrib_list, NULL, num_configs, &returned_configs) || returned_configs <= 0) {
|
||||||
egldisplay_cat.error() << "eglChooseConfig failed: "
|
egldisplay_cat.error() << "eglChooseConfig failed: "
|
||||||
<< get_egl_error_string(eglGetError()) << "\n";
|
<< get_egl_error_string(eglGetError()) << "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
num_configs = returned_configs;
|
||||||
|
EGLConfig *configs = new EGLConfig[num_configs];
|
||||||
|
|
||||||
|
if (!eglChooseConfig(_egl_display, attrib_list, configs, num_configs, &returned_configs) || returned_configs <= 0) {
|
||||||
|
egldisplay_cat.error() << "eglChooseConfig failed: "
|
||||||
|
<< get_egl_error_string(eglGetError()) << "\n";
|
||||||
|
delete[] configs;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int best_quality = 0;
|
int best_quality = 0;
|
||||||
int best_result = 0;
|
int best_result = 0;
|
||||||
FrameBufferProperties best_props;
|
FrameBufferProperties best_props;
|
||||||
|
|
||||||
if (configs != 0) {
|
|
||||||
for (int i = 0; i < num_configs; ++i) {
|
for (int i = 0; i < num_configs; ++i) {
|
||||||
FrameBufferProperties fbprops;
|
FrameBufferProperties fbprops;
|
||||||
bool pbuffer_supported, pixmap_supported, slow;
|
bool pbuffer_supported, pixmap_supported, slow;
|
||||||
@ -207,7 +216,6 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
|||||||
best_props = fbprops;
|
best_props = fbprops;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
int depth = DefaultDepth(_display, _screen);
|
int depth = DefaultDepth(_display, _screen);
|
||||||
_visual = new XVisualInfo;
|
_visual = new XVisualInfo;
|
||||||
XMatchVisualInfo(_display, _screen, depth, TrueColor, _visual);
|
XMatchVisualInfo(_display, _screen, depth, TrueColor, _visual);
|
||||||
@ -226,6 +234,7 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
|||||||
if (_context && err == EGL_SUCCESS) {
|
if (_context && err == EGL_SUCCESS) {
|
||||||
if (_visual) {
|
if (_visual) {
|
||||||
_fbprops = best_props;
|
_fbprops = best_props;
|
||||||
|
delete[] configs;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,6 +250,8 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
|||||||
|
|
||||||
egldisplay_cat.error() <<
|
egldisplay_cat.error() <<
|
||||||
"Could not find a usable pixel format.\n";
|
"Could not find a usable pixel format.\n";
|
||||||
|
|
||||||
|
delete[] configs;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user