Skip to content

Commit 8f9832f

Browse files
committed
gui/entity: Fix texture wrapping
1 parent d09cb69 commit 8f9832f

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

eurochef/gui/src/entities.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ impl EntityListPanel {
116116
t.height as i32,
117117
&d,
118118
glow::RGBA,
119+
t.flags,
119120
);
120121
frames.push(handle);
121122
}

eurochef/gui/src/render/gl_helper.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub unsafe fn load_texture(
4343
height: i32,
4444
data: &[u8],
4545
format: u32,
46+
flags: u32,
4647
) -> glow::Texture {
4748
let texture = gl.create_texture().unwrap();
4849
gl.bind_texture(glow::TEXTURE_2D, Some(texture));
@@ -62,6 +63,22 @@ pub unsafe fn load_texture(
6263
gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_WRAP_S, glow::REPEAT as i32);
6364
gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_WRAP_T, glow::REPEAT as i32);
6465

66+
// TODO: Bitflags
67+
if (flags & 0x100000) != 0 {
68+
gl.tex_parameter_i32(
69+
glow::TEXTURE_2D,
70+
glow::TEXTURE_WRAP_S,
71+
glow::CLAMP_TO_EDGE as i32,
72+
);
73+
}
74+
if (flags & 0x200000) != 0 {
75+
gl.tex_parameter_i32(
76+
glow::TEXTURE_2D,
77+
glow::TEXTURE_WRAP_T,
78+
glow::CLAMP_TO_EDGE as i32,
79+
);
80+
}
81+
6582
gl.generate_mipmap(glow::TEXTURE_2D);
6683

6784
texture

0 commit comments

Comments
 (0)