diff options
| author | HampusM <hampus@hampusmat.com> | 2026-04-18 13:30:32 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-04-18 13:30:32 +0200 |
| commit | 75558d144ca8c91ed5e87358d935b2c36eb29d7b (patch) | |
| tree | 748847bc8a5b6569b2a5901f3a08587a319358d3 /opengl-bindings/src | |
| parent | 770b64cb98c7e52d2ed3f75b817aaed5502461ab (diff) | |
feat(opengl-bindings): add scissor testing
Diffstat (limited to 'opengl-bindings/src')
| -rw-r--r-- | opengl-bindings/src/misc.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/opengl-bindings/src/misc.rs b/opengl-bindings/src/misc.rs index 2acc4bb..6206b79 100644 --- a/opengl-bindings/src/misc.rs +++ b/opengl-bindings/src/misc.rs @@ -115,6 +115,33 @@ pub fn get_context_flags(current_context: &CurrentContextWithFns<'_>) -> Context ContextFlags::from_bits_truncate(context_flags.cast_unsigned()) } +/// Defines a rectangle, called the scissor box, in window coordinates. +pub fn define_scissor_box( + current_context: &CurrentContextWithFns<'_>, + lower_left_corner_pos: Vec2<u16>, + size: Dimens<u16>, +) +{ + let lower_left_corner_pos = Vec2::<crate::sys::types::GLint> { + x: lower_left_corner_pos.x.into(), + y: lower_left_corner_pos.y.into(), + }; + + let size = Dimens::<crate::sys::types::GLsizei> { + width: size.width.into(), + height: size.height.into(), + }; + + unsafe { + current_context.fns().Scissor( + lower_left_corner_pos.x, + lower_left_corner_pos.y, + size.width, + size.height, + ); + } +} + bitflags! { #[derive(Debug, Clone, Copy)] pub struct BufferClearMask: u32 { @@ -130,6 +157,7 @@ bitflags! { pub enum Capability { DepthTest = crate::sys::DEPTH_TEST, + ScissorTest = crate::sys::SCISSOR_TEST, MultiSample = crate::sys::MULTISAMPLE, DebugOutput = crate::sys::DEBUG_OUTPUT, DebugOutputSynchronous = crate::sys::DEBUG_OUTPUT_SYNCHRONOUS, |
