-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write custom shaders for circular gauges #602
base: main
Are you sure you want to change the base?
Conversation
WIP, don't merge. I'll create implementations for the generic ProgressArcs too (they're trickier since the arc specified can be part of a notional circle whose diameter is far greater than the width or height of the gauge itself). |
6bc678f
to
d6bf8b5
Compare
Animating the Shape-based gauges is too expensive. So reimplement them as single-pass shaders.
d6bf8b5
to
10e70ee
Compare
Still WIP. Need to test on CerboGX. |
Unfortunately, https://bugreports.qt.io/browse/QTBUG-120112 might mean that we have to wait until Qt 6.6.x for this to work on webassembly, at least. This may not be a problem, since the performance problems don't show up on webassembly or desktop, but only on the CerboGX, so we can just load different types depending on the platform (shader vs non-shader gauges). The bigger problem is: (I haven't tested yet, but it's very possible that) the shader performance is poor on CerboGX due to the complexity of the shader. It may not be possible to draw everything using the shader, but instead draw only the progress bar with the shader. But, let's see, once we have the shader tools added to the SDK. |
@chriadam can you convert this PR to draft if it is not ready for review yet? |
By changing the name of the fragment shader's input from "coord" to "qt_TexCoord0" (to match Qt's default vertex shader output for older GLSL targets) the shaders now work. However, on the CerboGX they are incredibly slow, due to how complex the shaders are (e.g. the antialiasing, shine effect, etc). |
@@ -343,6 +343,7 @@ int main(int argc, char *argv[]) | |||
engine.setProperty("screenSize", (round(screenDiagonalMm / 10 / 2.5) == 7) | |||
? Victron::VenusOS::Theme::SevenInch | |||
: Victron::VenusOS::Theme::FiveInch); | |||
engine.setProperty("screenSize", Victron::VenusOS::Theme::SevenInch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debugging, should remove.
#version 440 | ||
#define CONSTANT_PI 3.141592653589793 | ||
#define CONSTANT_TAU 6.283185307179586 | ||
layout(location = 0) in vec2 coord; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have to change this to qt_TexCoord0 to work around QTBUG-120112
Animating the Shape-based circular gauges is too expensive. So reimplement it as a single-pass shader.