Skip to main content
added 101 characters in body
Source Link
Jon
  • 3.7k
  • 1
  • 14
  • 23

It is typical to use a 32-bit depth-buffer:

GL_DEPTH_COMPONENT32F //internal format
GL_DEPTH_COMPONENT    //depth only
GL_FLOAT              //float(32-bit depth)

If you also wish to utilize the stencil buffer, it is typical to dedicate 8 of those 32-bits to the stencil:

GL_DEPTH24_STENCIL8   //internal format
GL_DEPTH_STENCIL      //depth + stencil
GL_UNSIGNED_INT_24_8  //ushort(24-bit depth) + uchar(stencil)

If you require 32-bit precision for depth, but also require the stencil:

GL_DEPTH32F_STENCIL8               //internal format
GL_DEPTH_STENCIL                   //depth + stencil
GL_FLOAT_32_UNSIGNED_INT_24_8_REV  //float(32-bit depth) + ushort(spare) + uchar(stencil)

Refer to the last chart under "Description".

Stencil diagram:

enter image description here

It is typical to use a 32-bit depth-buffer:

GL_DEPTH_COMPONENT32F //internal format
GL_DEPTH_COMPONENT    //depth only
GL_FLOAT              //float(32-bit depth)

If you also wish to utilize the stencil buffer, it is typical to dedicate 8 of those 32-bits to the stencil:

GL_DEPTH24_STENCIL8   //internal format
GL_DEPTH_STENCIL      //depth + stencil
GL_UNSIGNED_INT_24_8  //ushort(24-bit depth) + uchar(stencil)

If you require 32-bit precision for depth, but also require the stencil:

GL_DEPTH32F_STENCIL8               //internal format
GL_DEPTH_STENCIL                   //depth + stencil
GL_FLOAT_32_UNSIGNED_INT_24_8_REV  //float(32-bit depth) + ushort(spare) + uchar(stencil)

Refer to the last chart under "Description".

It is typical to use a 32-bit depth-buffer:

GL_DEPTH_COMPONENT32F //internal format
GL_DEPTH_COMPONENT    //depth only
GL_FLOAT              //float(32-bit depth)

If you also wish to utilize the stencil buffer, it is typical to dedicate 8 of those 32-bits to the stencil:

GL_DEPTH24_STENCIL8   //internal format
GL_DEPTH_STENCIL      //depth + stencil
GL_UNSIGNED_INT_24_8  //ushort(24-bit depth) + uchar(stencil)

If you require 32-bit precision for depth, but also require the stencil:

GL_DEPTH32F_STENCIL8               //internal format
GL_DEPTH_STENCIL                   //depth + stencil
GL_FLOAT_32_UNSIGNED_INT_24_8_REV  //float(32-bit depth) + ushort(spare) + uchar(stencil)

Refer to the last chart under "Description".

Stencil diagram:

enter image description here

Source Link
Jon
  • 3.7k
  • 1
  • 14
  • 23

It is typical to use a 32-bit depth-buffer:

GL_DEPTH_COMPONENT32F //internal format
GL_DEPTH_COMPONENT    //depth only
GL_FLOAT              //float(32-bit depth)

If you also wish to utilize the stencil buffer, it is typical to dedicate 8 of those 32-bits to the stencil:

GL_DEPTH24_STENCIL8   //internal format
GL_DEPTH_STENCIL      //depth + stencil
GL_UNSIGNED_INT_24_8  //ushort(24-bit depth) + uchar(stencil)

If you require 32-bit precision for depth, but also require the stencil:

GL_DEPTH32F_STENCIL8               //internal format
GL_DEPTH_STENCIL                   //depth + stencil
GL_FLOAT_32_UNSIGNED_INT_24_8_REV  //float(32-bit depth) + ushort(spare) + uchar(stencil)

Refer to the last chart under "Description".