summaryrefslogtreecommitdiff
path: root/opengl-bindings/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-08-11 12:30:58 +0200
committerHampusM <hampus@hampusmat.com>2026-08-11 12:30:58 +0200
commit4860c458078f714df46e683944735645f9d73618 (patch)
tree1ac6293eb80a53f976fb7ea323d981df720443aa /opengl-bindings/src
parent37496a6db6b73b987b881ddd568d4a609389670c (diff)
feat(opengl-bindings): make more types derive Clone
Diffstat (limited to 'opengl-bindings/src')
-rw-r--r--opengl-bindings/src/buffer.rs4
-rw-r--r--opengl-bindings/src/shader.rs18
-rw-r--r--opengl-bindings/src/texture.rs4
-rw-r--r--opengl-bindings/src/vertex_array.rs2
4 files changed, 11 insertions, 17 deletions
diff --git a/opengl-bindings/src/buffer.rs b/opengl-bindings/src/buffer.rs
index 5045855..2567aba 100644
--- a/opengl-bindings/src/buffer.rs
+++ b/opengl-bindings/src/buffer.rs
@@ -6,7 +6,7 @@ use safer_ffi::layout::ReprC;
use crate::MaybeCurrentContextWithFns;
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct Buffer<Item: ReprC>
{
buf: crate::sys::types::GLuint,
@@ -242,7 +242,7 @@ impl Usage
}
}
-#[derive(Debug)]
+#[derive(Debug, Clone, Copy)]
#[repr(u32)]
pub enum BindingTarget
{
diff --git a/opengl-bindings/src/shader.rs b/opengl-bindings/src/shader.rs
index 00fec58..511b00c 100644
--- a/opengl-bindings/src/shader.rs
+++ b/opengl-bindings/src/shader.rs
@@ -6,7 +6,7 @@ use safer_ffi::layout::ReprC;
use crate::data_types::{Matrix, Vec3};
use crate::MaybeCurrentContextWithFns;
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct Shader
{
shader: crate::sys::types::GLuint,
@@ -128,7 +128,7 @@ pub enum Kind
}
/// Shader program
-#[derive(Debug, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Program
{
program: crate::sys::types::GLuint,
@@ -144,11 +144,7 @@ impl Program
Self { program }
}
- pub fn attach(
- &self,
- current_context: &MaybeCurrentContextWithFns,
- shader: &Shader,
- )
+ pub fn attach(&self, current_context: &MaybeCurrentContextWithFns, shader: &Shader)
{
unsafe {
current_context
@@ -161,10 +157,8 @@ impl Program
///
/// # Errors
/// Returns `Err` if linking fails.
- pub fn link(
- &self,
- current_context: &MaybeCurrentContextWithFns,
- ) -> Result<(), Error>
+ pub fn link(&self, current_context: &MaybeCurrentContextWithFns)
+ -> Result<(), Error>
{
unsafe {
current_context.fns().LinkProgram(self.program);
@@ -358,7 +352,7 @@ impl UniformVariable for Matrix<f32, 4, 4>
impl sealed::Sealed for Matrix<f32, 4, 4> {}
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct UniformLocation(crate::sys::types::GLint);
impl UniformLocation
diff --git a/opengl-bindings/src/texture.rs b/opengl-bindings/src/texture.rs
index c317c92..2f32bc9 100644
--- a/opengl-bindings/src/texture.rs
+++ b/opengl-bindings/src/texture.rs
@@ -3,7 +3,7 @@ use std::borrow::Cow;
use crate::data_types::{Dimens, Vec2};
use crate::MaybeCurrentContextWithFns;
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct Builder
{
size: Dimens<u32>,
@@ -134,7 +134,7 @@ impl Default for Builder
}
}
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct Texture
{
texture: crate::sys::types::GLuint,
diff --git a/opengl-bindings/src/vertex_array.rs b/opengl-bindings/src/vertex_array.rs
index 74ef899..91e62c5 100644
--- a/opengl-bindings/src/vertex_array.rs
+++ b/opengl-bindings/src/vertex_array.rs
@@ -5,7 +5,7 @@ use safer_ffi::layout::ReprC;
use crate::buffer::Buffer;
use crate::MaybeCurrentContextWithFns;
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct VertexArray
{
array: crate::sys::types::GLuint,