added and data folder and forgot to make buffers swap
parent
0ba9b8698c
commit
22e47de409
|
@ -0,0 +1,12 @@
|
||||||
|
#version 330 core
|
||||||
|
out vec4 FragColor;
|
||||||
|
|
||||||
|
in vec2 TexCoord;
|
||||||
|
|
||||||
|
// texture sampler
|
||||||
|
uniform sampler2D texture1;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
FragColor = texture(texture1, TexCoord);
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
17
src/main.rs
17
src/main.rs
|
@ -128,17 +128,32 @@ fn main() {
|
||||||
println!("closing gracefully");
|
println!("closing gracefully");
|
||||||
control_flow.exit();
|
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
|
// TODO to be implemented later
|
||||||
_ => ()
|
_ => ()
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Event::Resumed => {
|
||||||
|
|
||||||
|
},
|
||||||
Event::AboutToWait => {
|
Event::AboutToWait => {
|
||||||
unsafe {
|
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);
|
gl.clear(glow::COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO to be implemented
|
// TODO to be implemented
|
||||||
|
|
Loading…
Reference in New Issue