From d896f416d174fb6ae8e465ad6f4fe87751702659 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 26 Aug 2026 15:57:28 +0200 Subject: feat(opengl-bindings): add depth component texture pixel data format --- opengl-bindings/src/texture.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'opengl-bindings/src') diff --git a/opengl-bindings/src/texture.rs b/opengl-bindings/src/texture.rs index 9ed7926..4bf8ac6 100644 --- a/opengl-bindings/src/texture.rs +++ b/opengl-bindings/src/texture.rs @@ -421,6 +421,14 @@ pub enum SrgbaDataType UnsignedByte = crate::sys::UNSIGNED_BYTE, } +#[derive(Debug, Clone, Copy)] +#[non_exhaustive] +#[repr(u32)] +pub enum DepthComponentDataType +{ + Float32 = crate::sys::FLOAT, +} + /// Texture pixel data format. #[derive(Debug, Clone, Copy)] #[non_exhaustive] @@ -430,6 +438,7 @@ pub enum PixelDataFormat Rgba(RgbaDataType), Srgb(SrgbDataType), Srgba(SrgbaDataType), + DepthComponent(DepthComponentDataType), } impl PixelDataFormat @@ -441,6 +450,9 @@ impl PixelDataFormat Self::Rgba(RgbaDataType::UnsignedByte) => crate::sys::RGBA8, Self::Srgb(SrgbDataType::UnsignedByte) => crate::sys::SRGB8, Self::Srgba(SrgbaDataType::UnsignedByte) => crate::sys::SRGB8_ALPHA8, + Self::DepthComponent(DepthComponentDataType::Float32) => { + crate::sys::DEPTH_COMPONENT32F + } } } @@ -449,6 +461,7 @@ impl PixelDataFormat match self { Self::Rgb(_) | Self::Srgb(_) => crate::sys::RGB, Self::Rgba(_) | Self::Srgba(_) => crate::sys::RGBA, + Self::DepthComponent(_) => crate::sys::DEPTH_COMPONENT, } } @@ -459,6 +472,7 @@ impl PixelDataFormat Self::Srgb(ty) => ty as crate::sys::types::GLenum, Self::Rgba(ty) => ty as crate::sys::types::GLenum, Self::Srgba(ty) => ty as crate::sys::types::GLenum, + Self::DepthComponent(ty) => ty as crate::sys::types::GLenum, } } @@ -467,6 +481,7 @@ impl PixelDataFormat match self { Self::Rgb(_) | Self::Srgb(_) => 3, Self::Rgba(_) | Self::Srgba(_) => 4, + Self::DepthComponent(_) => 1, } } } -- cgit v1.2.3-18-g5258