added and data folder and forgot to make buffers swap

pull/4/head
Milk.H 2024-04-25 18:04:00 +01:00
parent 0ba9b8698c
commit 22e47de409
Signed by: milk
GPG Key ID: 94C7CB70FFF80593
3 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,12 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoord;
// texture sampler
uniform sampler2D texture1;
void main()
{
FragColor = texture(texture1, TexCoord);
}

View File

@ -0,0 +1,16 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;
uniform float frameTime;
uniform float frameCount;
uniform float scale;
uniform vec2 uniPos;
out vec2 TexCoord;
void main()
{
TexCoord = vec2((aTexCoord.x + frameTime + 0.0001)*frameCount, aTexCoord.y + 0.0001);
gl_Position = vec4(vec3(aPos.x + uniPos.x, aPos.y + uniPos.y, aPos.z) * scale, 1.0);
}

View File

@ -128,17 +128,32 @@ fn main() {
println!("closing gracefully");
control_flow.exit();
},
WindowEvent::Resized(size) => {
if size.width !=0 && size.height !=0 {
gl_surface.resize(
&gl_context,
std::num::NonZeroU32::new(size.width).unwrap(),
std::num::NonZeroU32::new(size.height).unwrap()
);
}
},
// TODO to be implemented later
_ => ()
};
}
Event::Resumed => {
},
Event::AboutToWait => {
unsafe {
gl.clear_color(0.0, 0.0, 0.0, 0.0);
gl_surface.swap_buffers(&gl_context).unwrap();
gl.clear_color(0.0, 0.0, 0.0, 1.0);
gl.clear(glow::COLOR_BUFFER_BIT);
}
},
// TODO to be implemented