Skip to content
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

Use shaders on drawing gridline #147

Open
SC-One opened this issue Feb 5, 2022 · 2 comments
Open

Use shaders on drawing gridline #147

SC-One opened this issue Feb 5, 2022 · 2 comments

Comments

@SC-One
Copy link
Contributor

SC-One commented Feb 5, 2022

Hi , I have a question , I dont know this solution is better than now or not !
because of that I said that here before any starting , do you think if we draw gridline in linegrid by shaders make our application faster?
sometimes I have delay and lag when unzoom (totaly) , I think it's because of gridline and redrawing items , but gridline useage is more than another .

Im new in GLSL (Im C++ developer not shaders :D) but maybe I can fix that if I try .
do you think drawing that is better than now for imporving performance?
If I do that do you merge that ? or prefer to trade off readability(shaders are not so comfortable for Developers) vs performance?

@SC-One
Copy link
Contributor Author

SC-One commented Feb 5, 2022

Note: In general large canvases, frequent updates, and animation should be avoided with the Canvas.Image render target. This is because with accelerated graphics APIs each update will lead to a texture upload. Also, if possible, prefer QQuickPaintedItem and implement drawing in C++ via QPainter instead of the more expensive and likely less performing JavaScript and Context2D approach.

Ref: https://doc.qt.io/qt-5/qml-qtquick-canvas.html#tips-for-porting-existing-html5-canvas-applications

@cneben
Copy link
Owner

cneben commented Aug 10, 2022

Hi @SC-One , thanks for your suggestion (and sorry for answer delay), in fact line(and arrow) rendering was done in GLSL years ago, but it is just too hard to maintain and have proper antialisaing without mipmaping.
I end up using regular canvas because of antialiasing problems with quick painted item (for example, vertical/horizontal lines randomly painted on 2 pixels for some position).
I think some kind of DearImGui canvas compatible with QtQuick would be the better option, but I have no time to invest on that matter since performances level is ok for my graphs at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants