generated from lks/eframe_template_android
Compare commits
2 Commits
7f6d5069f8
...
5cecec3f70
| Author | SHA1 | Date | |
|---|---|---|---|
| 5cecec3f70 | |||
| 636f67c6de |
@ -55,6 +55,8 @@ impl eframe::App for TemplateApp {
|
|||||||
// Put your widgets into a `SidePanel`, `TopBottomPanel`, `CentralPanel`, `Window` or `Area`.
|
// Put your widgets into a `SidePanel`, `TopBottomPanel`, `CentralPanel`, `Window` or `Area`.
|
||||||
// For inspiration and more examples, go to https://emilk.github.io/egui
|
// For inspiration and more examples, go to https://emilk.github.io/egui
|
||||||
|
|
||||||
|
ctx.request_repaint();
|
||||||
|
|
||||||
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
|
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
|
||||||
// The top panel is often a good place for a menu bar:
|
// The top panel is often a good place for a menu bar:
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use eframe::glow::{self, PixelUnpackData, TEXTURE0, TEXTURE1, UNSIGNED_BYTE};
|
use eframe::glow::{self, PixelUnpackData, TEXTURE0, TEXTURE1, UNSIGNED_BYTE};
|
||||||
use glow::HasContext as _;
|
use glow::HasContext as _;
|
||||||
use glow::{NEAREST, TEXTURE_1D, TEXTURE_2D, TEXTURE_MAG_FILTER, TEXTURE_MIN_FILTER};
|
use glow::{NEAREST, TEXTURE_2D, TEXTURE_MAG_FILTER, TEXTURE_MIN_FILTER};
|
||||||
use log;
|
use log;
|
||||||
use std::mem::{size_of, transmute};
|
use std::mem::{size_of, transmute};
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ impl Waterfall {
|
|||||||
// Bind our texturs
|
// Bind our texturs
|
||||||
gl.active_texture(TEXTURE1);
|
gl.active_texture(TEXTURE1);
|
||||||
check_for_gl_errors(&gl, "Active texture 1");
|
check_for_gl_errors(&gl, "Active texture 1");
|
||||||
gl.bind_texture(glow::TEXTURE_1D, Some(self.color_lut));
|
gl.bind_texture(glow::TEXTURE_2D, Some(self.color_lut));
|
||||||
check_for_gl_errors(&gl, "bind lut");
|
check_for_gl_errors(&gl, "bind lut");
|
||||||
|
|
||||||
gl.active_texture(TEXTURE0);
|
gl.active_texture(TEXTURE0);
|
||||||
@ -208,15 +208,22 @@ impl Waterfall {
|
|||||||
let color_lut = gl
|
let color_lut = gl
|
||||||
.create_texture()
|
.create_texture()
|
||||||
.expect("Waterfall: could not create LUT");
|
.expect("Waterfall: could not create LUT");
|
||||||
gl.bind_texture(TEXTURE_1D, Some(color_lut));
|
gl.bind_texture(TEXTURE_2D, Some(color_lut));
|
||||||
gl.tex_parameter_i32(TEXTURE_1D, TEXTURE_MIN_FILTER, NEAREST as i32);
|
check_for_gl_errors(&gl, "Setup Bind LUT");
|
||||||
gl.tex_parameter_i32(TEXTURE_1D, TEXTURE_MAG_FILTER, NEAREST as i32);
|
gl.tex_parameter_i32(TEXTURE_2D, TEXTURE_MIN_FILTER, NEAREST as i32);
|
||||||
check_for_gl_errors(&gl, "Set LUT params");
|
check_for_gl_errors(&gl, "Set LUT MIN_FILTER");
|
||||||
gl.tex_image_1d(
|
gl.tex_parameter_i32(TEXTURE_2D, TEXTURE_MAG_FILTER, NEAREST as i32);
|
||||||
TEXTURE_1D,
|
check_for_gl_errors(&gl, "Set LUT MAG_FILTER");
|
||||||
|
gl.tex_image_2d(
|
||||||
|
TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
glow::SRGB as i32,
|
if cfg!(target_os = "android") {
|
||||||
|
glow::RGB
|
||||||
|
} else {
|
||||||
|
glow::SRGB
|
||||||
|
} as i32,
|
||||||
256,
|
256,
|
||||||
|
1,
|
||||||
0,
|
0,
|
||||||
glow::RGB,
|
glow::RGB,
|
||||||
UNSIGNED_BYTE,
|
UNSIGNED_BYTE,
|
||||||
@ -250,13 +257,13 @@ impl Waterfall {
|
|||||||
|
|
||||||
// texture sampler
|
// texture sampler
|
||||||
uniform sampler2D texture1;
|
uniform sampler2D texture1;
|
||||||
uniform sampler1D LUT;
|
uniform sampler2D LUT;
|
||||||
uniform float offset;
|
uniform float offset;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float val = texture(texture1, vec2(TexCoord.x, TexCoord.y + offset)).x;
|
float val = texture(texture1, vec2(TexCoord.x, TexCoord.y + offset)).x;
|
||||||
FragColor = texture(LUT, val);
|
FragColor = texture(LUT, vec2(val, 0));
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user