Search code examples
opengllwjglglfw

GLFW Window Hints: Colour Bit Depth


In my game, I am trying to create a glfw window with no depth buffer, stencil buffer or alpha buffer, because all I want it to do is render a 2D image to the screen, the result of a previous framebuffer.

So I use the following initialization code:

glfwDefaultWindowHints();       
glfwWindowHint(GLFW_DEPTH_BITS, 0);
glfwWindowHint(GLFW_STENCIL_BITS, 0);
glfwWindowHint(GLFW_ALPHA_BITS, 0);

However, when I create my window and call glGetInteger(GL_ALPHA_BITS), It returns 8. The Depth bits and stencil bits are 0 however.

My question is, when I specify a 'hint' using glfwWindowHint(), is it a recommendation for how the window should be created or something that must be.


Solution

  • Yes, it is a recommendation. But having more alpha bits is not a problem, since alpha blending can be enabled and disabled with glEnable(GL_BLEND)/glDisable(GL_BLEND)