summaryrefslogtreecommitdiff
path: root/engine/src/opengl/texture.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/opengl/texture.rs')
-rw-r--r--engine/src/opengl/texture.rs36
1 files changed, 2 insertions, 34 deletions
diff --git a/engine/src/opengl/texture.rs b/engine/src/opengl/texture.rs
index 706b9c9..80a5f37 100644
--- a/engine/src/opengl/texture.rs
+++ b/engine/src/opengl/texture.rs
@@ -19,10 +19,10 @@ impl Texture
Self { texture }
}
- pub fn bind(&self)
+ pub fn bind_to_texture_unit(&self, texture_unit: u32)
{
unsafe {
- gl::BindTexture(gl::TEXTURE_2D, self.texture);
+ gl::BindTextureUnit(texture_unit, self.texture);
}
}
@@ -167,35 +167,3 @@ impl PixelDataFormat
}
}
}
-
-pub fn set_active_texture_unit(texture_unit: TextureUnit)
-{
- unsafe {
- gl::ActiveTexture(texture_unit.into_gl());
- }
-}
-
-macro_rules! texture_unit_enum {
- (cnt=$cnt: literal) => {
- seq_macro::seq!(N in 0..$cnt {
- #[derive(Debug, Clone, Copy)]
- pub enum TextureUnit {
- #(
- No~N,
- )*
- }
-
- impl TextureUnit {
- fn into_gl(self) -> gl::types::GLenum {
- match self {
- #(
- Self::No~N => gl::TEXTURE~N,
- )*
- }
- }
- }
- });
- };
-}
-
-texture_unit_enum!(cnt = 3);