Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I would like to know what are the following "framebuffer related hints" of GLFW3 function glfwWindowHint :

GLFW_RED_BITS GLFW_GREEN_BITS GLFW_BLUE_BITS GLFW_ALPHA_BITS GLFW_DEPTH_BITS GLFW_STENCIL_BITS

  • What is the purpose of this?
  • Usually their default values are enough?
  • Where are those bits stored? In a buffer in the GPU?
  • What do they affect? And by that I mean in what way

Thank you in advance!

share|improve this question

1 Answer 1

up vote 3 down vote accepted

These flags allow you to specify the formatting of your color target, and depth stencil buffers that are a part of the final frame buffer.

The color target is typically formatted in a R8G8B8A8 format, providing 8 bits of precision for each color, and the alpha channel. This gives a total of 32 bits.

The final two flags specify formatting for the depth stencil, this is typically formatted as D24S8, and this indicates 24 bits of precision for the depth buffer, and 8 bits for the stencil. Higher precision on the depth buffer allows for more accurate depth testing when checking for overdraw.

When the frame buffer targets are created, it will use these formatting specifiers to indicate to the rendering pipeline how to interpret the data when reading from and writing to it. These buffers are allocated in VRAM to provide faster access to the GPU.

share|improve this answer
    
Thanks a lot, great anwser! –  Rui d'Orey Jun 24 '13 at 12:33
    
Note torbjoernwh's edit reason: "the typical framebuffer format on desktop GL is 8-bits per channel. Not 32 bits per channel. If you used 32 bits per channel you would waste a lot of bits, as monitors are limited to much fewer bits. Also, the final framebuffer would require 4x as much memory..." –  Byte56 Jun 25 '13 at 21:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.