Review window creation hints

This commit is contained in:
Ray 2018-06-02 18:26:57 +02:00
parent c7d6a44e33
commit 9688c677de
4 changed files with 22 additions and 25 deletions

View File

@ -92,7 +92,7 @@
#define FLAG_SHOW_LOGO 1 // Set to show raylib logo at startup
#define FLAG_FULLSCREEN_MODE 2 // Set to run program in fullscreen
#define FLAG_WINDOW_RESIZABLE 4 // Set to allow resizable window
#define FLAG_WINDOW_DECORATED 8 // Set to show window decoration (frame and buttons)
#define FLAG_WINDOW_UNDECORATED 8 // Set to disable window decoration (frame and buttons)
#define FLAG_WINDOW_TRANSPARENT 16 // Set to allow transparent window
#define FLAG_MSAA_4X_HINT 32 // Set to try enabling MSAA 4X
#define FLAG_VSYNC_HINT 64 // Set to try enabling V-Sync on GPU

View File

@ -1884,30 +1884,27 @@ static bool InitGraphicsDevice(int width, int height)
displayHeight = screenHeight;
#endif // defined(PLATFORM_WEB)
glfwDefaultWindowHints(); // Set default windows hints
glfwDefaultWindowHints(); // Set default windows hints:
//glfwWindowHint(GLFW_RED_BITS, 8); // Framebuffer red color component bits
//glfwWindowHint(GLFW_GREEN_BITS, 8); // Framebuffer green color component bits
//glfwWindowHint(GLFW_BLUE_BITS, 8); // Framebuffer blue color component bits
//glfwWindowHint(GLFW_ALPHA_BITS, 8); // Framebuffer alpha color component bits
//glfwWindowHint(GLFW_DEPTH_BITS, 24); // Depthbuffer bits
//glfwWindowHint(GLFW_REFRESH_RATE, 0); // Refresh rate for fullscreen window
//glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); // OpenGL API to use. Alternative: GLFW_OPENGL_ES_API
//glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
// Check some Window creation flags
if (configFlags & FLAG_WINDOW_RESIZABLE) glfwWindowHint(GLFW_RESIZABLE, GL_TRUE); // Resizable window
else glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); // Avoid window being resizable
if (configFlags & FLAG_WINDOW_DECORATED) glfwWindowHint(GLFW_DECORATED, GL_TRUE); // Border and buttons on Window
if (configFlags & FLAG_WINDOW_UNDECORATED) glfwWindowHint(GLFW_DECORATED, GL_FALSE); // Border and buttons on Window
else glfwWindowHint(GLFW_DECORATED, GL_TRUE); // Decorated window
if (configFlags & FLAG_WINDOW_TRANSPARENT)
{
// TODO: Enable transparent window (not ready yet on GLFW 3.2)
}
if (configFlags & FLAG_WINDOW_TRANSPARENT) glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); // Transparent framebuffer
else glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE); // Opaque framebuffer
if (configFlags & FLAG_MSAA_4X_HINT)
{
glfwWindowHint(GLFW_SAMPLES, 4); // Enables multisampling x4 (MSAA), default is 0
TraceLog(LOG_INFO, "Trying to enable MSAA x4");
}
//glfwWindowHint(GLFW_RED_BITS, 8); // Framebuffer red color component bits
//glfwWindowHint(GLFW_DEPTH_BITS, 16); // Depthbuffer bits (24 by default)
//glfwWindowHint(GLFW_REFRESH_RATE, 0); // Refresh rate for fullscreen window
//glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); // Default OpenGL API to use. Alternative: GLFW_OPENGL_ES_API
//glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
if (configFlags & FLAG_MSAA_4X_HINT) glfwWindowHint(GLFW_SAMPLES, 4); // Tries to enable multisampling x4 (MSAA), default is 0
// NOTE: When asking for an OpenGL context version, most drivers provide highest supported version
// with forward compatibility to older OpenGL versions.
@ -1926,11 +1923,11 @@ static bool InitGraphicsDevice(int width, int height)
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Profiles Hint: Only 3.3 and above!
// Other values: GLFW_OPENGL_ANY_PROFILE, GLFW_OPENGL_COMPAT_PROFILE
#if defined(__APPLE__)
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // OSX Requires
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // OSX Requires fordward compatibility
#else
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE); // Fordward Compatibility Hint: Only 3.3 and above!
#endif
//glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
//glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE); // Request OpenGL DEBUG context
}
if (fullscreen)

View File

@ -92,7 +92,7 @@
#define FLAG_SHOW_LOGO 1 // Set to show raylib logo at startup
#define FLAG_FULLSCREEN_MODE 2 // Set to run program in fullscreen
#define FLAG_WINDOW_RESIZABLE 4 // Set to allow resizable window
#define FLAG_WINDOW_DECORATED 8 // Set to show window decoration (frame and buttons)
#define FLAG_WINDOW_UNDECORATED 8 // Set to disable window decoration (frame and buttons)
#define FLAG_WINDOW_TRANSPARENT 16 // Set to allow transparent window
#define FLAG_MSAA_4X_HINT 32 // Set to try enabling MSAA 4X
#define FLAG_VSYNC_HINT 64 // Set to try enabling V-Sync on GPU