当前位置: 首页 > news >正文

qcustomplot 大量数据拖拽卡顿,开启opengl

记录一下qcustomplot在加载大量数据情况下卡顿的解决办法。

1. 导入库文件

QT       += core gui  opengl
DEFINES += QCUSTOMPLOT_USE_OPENGLwin32:LIBS += -lOpengl32 \-lglu32 \-lglut

2. 开启opengl

customplot->setOpenGl(true);

3. 解决opengl异常缩放问题

修改qcustomplot.cpp源码中mGlPaintDevice.data()->setDevicePixelRatio(mDevicePixelRatio);改为 mGlPaintDevice.data()->setDevicePixelRatio(1.0);

void QCPPaintBufferGlFbo::reallocateBuffer()
{// release and delete possibly existing framebuffer:if (mGlFrameBuffer){if (mGlFrameBuffer->isBound())mGlFrameBuffer->release();delete mGlFrameBuffer;mGlFrameBuffer = 0;}if (mGlContext.isNull()){qDebug() << Q_FUNC_INFO << "OpenGL context doesn't exist";return;}if (mGlPaintDevice.isNull()){qDebug() << Q_FUNC_INFO << "OpenGL paint device doesn't exist";return;}// create new fbo with appropriate size:mGlContext.data()->makeCurrent(mGlContext.data()->surface());QOpenGLFramebufferObjectFormat frameBufferFormat;frameBufferFormat.setSamples(mGlContext.data()->format().samples());frameBufferFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);mGlFrameBuffer = new QOpenGLFramebufferObject(mSize*mDevicePixelRatio, frameBufferFormat);if (mGlPaintDevice.data()->size() != mSize*mDevicePixelRatio)mGlPaintDevice.data()->setSize(mSize*mDevicePixelRatio);
#ifdef QCP_DEVICEPIXELRATIO_SUPPORTED// mGlPaintDevice.data()->setDevicePixelRatio(mDevicePixelRatio);mGlPaintDevice.data()->setDevicePixelRatio(1.0);
#endif}
http://www.lryc.cn/news/606838.html

相关文章:

  • SketchUp扩展工具分享:Ropefall v1.02插件轻松实现绳索模拟
  • 1、【C语言】【进阶】数组,指针与退化
  • 函数fdopendir的用法
  • [vue3 echarts] echarts 动态数据更新 setInterval
  • 深度学习(鱼书)day08--误差反向传播(后三节)
  • 轻钢屋顶电动排烟窗(工业用)
  • ansible.cfg 配置文件的常见配置项及其说明
  • SQL中的HAVING用法
  • MySQL--组从复制的详解及功能演练
  • 从O(n²)到O(n log n):深度剖析快速排序的内存优化与cache-friendly实现
  • 高级11-Java日志管理:使用Log4j与SLF4J
  • Oracle EBS 缺少adcfgclone.pl文件
  • 电商前端Nginx访问日志收集分析实战
  • 汇川ITS7100E触摸屏交互界面开发(一)调试事项说明
  • 25电赛e题杂乱环境稳定识别矩形框(附源码)
  • Vue3 Vue3中的响应式原理
  • StarRocks vs. Trino
  • 九联UNT403HS_海思MV320处理器_安卓9-优盘强刷刷机包
  • 嵌入式 Linux 深度解析:架构、原理与工程实践(增强版)
  • 企业级LLM智能引擎 的完整解决方案,整合了 SpringAI框架、RAG技术、模型控制平台(MCP)和实时搜索,提供从架构设计到代码实现的全面指南:
  • cloudflare worker + Cloudflare AI Gateway
  • 如何在不依赖 Office 的情况下转换 PDF 为可编辑文档
  • python中appium
  • K8S周期性备份etcd数据实战案例
  • 精通分类:解析Scikit-learn中的KNN、朴素贝叶斯与决策树(含随机森林)
  • 应用药品注册证识别技术,为医药行业的合规、高效与创新发展提供核心驱动力
  • 智能图书馆管理系统开发实战系列(四):后端C++ DLL开发与模块化设计
  • Dify版本升级实操
  • 体育直播系统搭建:核心数据详细接入指南
  • 网络编程-加密算法