mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 22:55:46 +00:00
Reintroduced manual framebuffer config selection.
The default behavior of WGL, EGL and GLX is to choose a config that has /at least/ the specified number of bits, whereas the GLFW 2 behavior was to choose the closest match with very few hard constraints. Moving the responsibility of finding the supported minimum values to the client was problematic, as there's no way to enumerate supported configurations, forcing the client to perform multiple (and slow) window/context creation attempts. Not even the currently set defaults (24-bit color and depth, 8-bit stencil) is universally supported, as bug reports show.
This commit is contained in:
+20
-2
@@ -153,8 +153,11 @@ struct _GLFWwndconfig
|
||||
|
||||
/*! @brief Framebuffer configuration.
|
||||
*
|
||||
* This describes buffers and their sizes. It is used to pass framebuffer
|
||||
* parameters from shared code to the platform API.
|
||||
* This describes buffers and their sizes. It also contains
|
||||
* a platform-specific ID used to map back to the backend API's object.
|
||||
*
|
||||
* It is used to pass framebuffer parameters from shared code to the platform
|
||||
* API and also to enumerate and select available framebuffer configs.
|
||||
*/
|
||||
struct _GLFWfbconfig
|
||||
{
|
||||
@@ -172,6 +175,9 @@ struct _GLFWfbconfig
|
||||
GLboolean stereo;
|
||||
int samples;
|
||||
GLboolean sRGB;
|
||||
|
||||
// This is defined in the context API's platform.h
|
||||
_GLFW_PLATFORM_FBCONFIG;
|
||||
};
|
||||
|
||||
|
||||
@@ -670,6 +676,18 @@ void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
|
||||
*/
|
||||
int _glfwStringInExtensionString(const char* string, const GLubyte* extensions);
|
||||
|
||||
/*! @brief Chooses the framebuffer config that best matches the desired one.
|
||||
* @param[in] desired The desired framebuffer config.
|
||||
* @param[in] alternatives The framebuffer configs supported by the system.
|
||||
* @param[in] count The number of entries in the alternatives array.
|
||||
* @return The framebuffer config most closely matching the desired one, or @c
|
||||
* NULL if none fulfilled the hard constraints of the desired values.
|
||||
* @ingroup utility
|
||||
*/
|
||||
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||
const _GLFWfbconfig* alternatives,
|
||||
unsigned int count);
|
||||
|
||||
/*! @brief Checks and reads back properties from the current context.
|
||||
* @return `GL_TRUE` if successful, or `GL_FALSE` if the context is unusable.
|
||||
* @ingroup utility
|
||||
|
||||
Reference in New Issue
Block a user