fix 26 channel color offset

This commit is contained in:
Matthieu Baumann
2025-08-28 17:48:48 +02:00
parent 950d0c693e
commit 8187747082
2 changed files with 15 additions and 1 deletions

View File

@@ -133,7 +133,6 @@ impl App {
//let exec = Rc::new(RefCell::new(TaskExecutor::new()));
let projection = ProjectionType::Sin(mapproj::zenithal::sin::Sin);
gl.enable(WebGl2RenderingContext::BLEND);
// TODO: https://caniuse.com/?search=scissor is not supported for safari <= 14.1
// When it will be supported nearly everywhere, we will need to uncomment this line to
@@ -829,6 +828,7 @@ impl App {
// Render the scene
// Clear all the screen first (only the region set by the scissor)
gl.clear(WebGl2RenderingContext::COLOR_BUFFER_BIT);
// set the blending options
layers.draw(camera, shaders, colormaps, projection)?;

View File

@@ -213,9 +213,13 @@ impl Layers {
let raytracer = &self.raytracer;
let raytracing = camera.is_raytracing(projection);
// The first layer or the background must be plot with no blending
self.gl.disable(WebGl2RenderingContext::BLEND);
// Check whether a hips to plot is allsky
// if neither are, we draw a font
// if there are, we do not draw nothing
let mut idx_start_layer = -1;
for (idx, layer) in self.layers.iter().enumerate() {
@@ -235,6 +239,8 @@ impl Layers {
}
}
let mut blending_enabled = false;
// Need to render transparency font
if idx_start_layer == -1 {
let vao = if raytracing {
@@ -258,6 +264,9 @@ impl Layers {
// The background (index -1) has been drawn, we can draw the first HiPS
idx_start_layer = 0;
self.gl.enable(WebGl2RenderingContext::BLEND);
blending_enabled = true;
}
let layers_to_render = &self.layers[(idx_start_layer as usize)..];
@@ -283,6 +292,11 @@ impl Layers {
}
}
}
if !blending_enabled {
self.gl.enable(WebGl2RenderingContext::BLEND);
blending_enabled = true;
}
}
Ok(())