summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opengl-bindings/src/vertex_array.rs29
1 files changed, 18 insertions, 11 deletions
diff --git a/opengl-bindings/src/vertex_array.rs b/opengl-bindings/src/vertex_array.rs
index d3af604..5d80c0c 100644
--- a/opengl-bindings/src/vertex_array.rs
+++ b/opengl-bindings/src/vertex_array.rs
@@ -146,23 +146,21 @@ impl VertexArray
&self,
current_context: &CurrentContextWithFns<'_>,
attrib_index: u32,
- data_type: DataType,
- normalized: bool,
- offset: u32,
+ attrib_format: AttributeFormat,
)
{
unsafe {
current_context.fns().VertexArrayAttribFormat(
self.array,
attrib_index,
- data_type.size(),
- data_type as u32,
- if normalized {
+ attrib_format.count.into(),
+ attrib_format.data_type.into_gl(),
+ if attrib_format.normalized {
crate::sys::TRUE
} else {
crate::sys::FALSE
},
- offset,
+ attrib_format.offset,
);
}
}
@@ -216,22 +214,31 @@ impl PrimitiveKind
}
#[derive(Debug, Clone, Copy)]
-#[repr(u32)]
+#[non_exhaustive]
pub enum DataType
{
- Float = crate::sys::FLOAT,
+ Float,
}
impl DataType
{
- fn size(self) -> crate::sys::types::GLint
+ fn into_gl(self) -> crate::sys::types::GLenum
{
match self {
- Self::Float => const { cast_usize_to_c_int(size_of::<f32>()) },
+ Self::Float => crate::sys::FLOAT,
}
}
}
+#[derive(Debug, Clone)]
+pub struct AttributeFormat
+{
+ pub data_type: DataType,
+ pub count: u8,
+ pub normalized: bool,
+ pub offset: u32,
+}
+
#[derive(Debug, thiserror::Error)]
pub enum DrawError
{