Sign in to follow this  

Color depths

Recommended Posts

I've been looking around for a while, but I can't find any information (maybe I'm just stupid, could be) on how many bits for everything is used at different "bits per pixel". I'm wondering if my "table" below is correct,a nd what the ?'s should be.
          red    green    blue    alpha    depth buffer    stencil buffer
16 BPP    5      6        5       0(?)     16(?)           ?
24 BPP    8      8        8       0(?)     24(?)           ?
32 BPP    8      8        8       8        24(?)           8
I'm trying to make my engine (which uses GLFW for window creation and input handling) use bits per pixel instead of having the user write the depth of every color manually. Thanks in advance! :) Sorry if I'm totally lost, it's very possible I am.

Share this post

Link to post
Share on other sites
Actually, you are right in a sense, and yet not.

Because, at least when using Direct3D, you can select what each depth should contain, such as R5G5B6 (for R:5 B:5 G:5), or perhaps X1R5G5B5, or you chould use 24D8S (depth:24 stencil:8)... and so on.

Check the Direct3D for documentation on backbuffers and a like and you will see.

So as you pointed out, the bits are just spread out in the different fields according to the format.

from DX documentation:

D3DFMT_D24S8 - 32-bit z-buffer bit depth using 24 bits for the depth channel and 8 bits for the stencil channel.

D3DFMT_R8G8B8 - 24-bit RGB pixel format with 8 bits per channel.
D3DFMT_A8R8G8B8 - 32-bit ARGB pixel format with alpha, using 8 bits per channel.
D3DFMT_X8R8G8B8 - 32-bit RGB pixel format, where 8 bits are reserved for each color.

Share this post

Link to post
Share on other sites
GLFW lets you specify all of those components seperately in glfwOpenWindow. If the video card driver doesn't support the combination you supplied (unlikely unless you did something wacky) then GLFW will choose the closest mode.

There is no table that maps bpp to the depth and stencil buffer, there isn't really any relation between the two. Is there a reason you need anything other than the standard 32 bpp color, 32bpp depth screen format?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this