Qt 5.5和OpenGL:检索设备信息 [英] Qt 5.5 and OpenGL: Retrieving device info

查看:128
本文介绍了Qt 5.5和OpenGL:检索设备信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个Qt 5.5应用程序,它以QOpenGLWidget的形式使用OpenGL.现在,我想要它,以便用户可以从应用程序中查看其设备信息.我的意思是:

I've written a Qt 5.5 application that uses OpenGL in the form of a QOpenGLWidget. Now I'd like it so that the user can see their device info from the application. By this I mean something along the lines of:

  • 卡的名称,例如"GT 640"
  • 供应商
  • 总GPU内存
  • 驱动程序版本
  • 扩展列表

到目前为止,我本人一直找不到任何相关功能.尽管我知道可以通过调用OpenGL来完成,但我宁愿将所有代码保持在较高水平.我发现这个很老2004年的帖子指出Qt没有此功能,但也许时代已经改变了?

So far, I myself have been unable to find any relating functions. Although I am aware that this can be done by making calls to OpenGL, I'd much rather keep all the code relatively high-level. I found this very old post from 2004 stating that Qt does not have this feature, but maybe times have changed?

推荐答案

  • 卡名:没有跨平台的获取方式. 可能作为glGetString(GL_RENDERER)的一部分返回,例如在NVIDIA I get

    • Card name: no cross-platform way of getting it. It may be returned as part of glGetString(GL_RENDERER), for instance on NVIDIA I get

      GeForce GTX 980 PCIe/SSE2

      GeForce GTX 980 PCIe/SSE2

    • 供应商:glGetString(GL_VENDOR)

      NVIDIA Corporation

      NVIDIA Corporation

    • GPU总内存:绝对不能跨平台.对于NVIDIA,AMD_gpu_association(取决于平台),请使用 GL_NVX_gpu_memory_info 对于AMD/ATI, GL_ATI_meminfo .请注意,知道VRAM的数量几乎是无用的,对于要尝试创建的任何特定对象,都有几个子限制(最大VBO大小,最大纹理大小,纹理级别大小,渲染缓冲区大小...).

    • Total GPU memory: absolutely not cross platform. Use GL_NVX_gpu_memory_info for NVIDIA, AMD_gpu_association (platform dependent) or GL_ATI_meminfo for AMD/ATI. Note that knowing the amount of VRAM is almost useless, you have several sublimits for any particular object you will try to create (maximum VBO size, maximum texture size, texture level size, renderbuffer size...).

      驱动程序版本:绝对不是跨平台的, 可能会包含在glGetString(GL_VERSION)中(它允许最后提供特定于供应商的信息),否则,您将需要再次去特定平台:

      Driver version: absolutely not cross platform, may be included as part of glGetString(GL_VERSION) (which allows for vendor-specific info at the end), otherwise you'll need once more to go platform-specific:

      4.5.0 NVIDIA 346.87

      4.5.0 NVIDIA 346.87

    • 扩展列表:带有Qt,QOpenGLContext::extensions()hasExtension(),以及已解析的函数指针助手(getProcAddress()QOpenGLFunctionsQOpenGLVersionFunctions等).任何其他GL解析器(例如GLEW)都具有等效的方法.而且您想要使用解析器,而不必再次使用特定于平台的内容...

    • Extensions list: with Qt, QOpenGLContext::extensions(), hasExtension(), plus the resolved function pointer helpers (getProcAddress(), QOpenGLFunctions, QOpenGLVersionFunctions, etc.). Any other GL resolver (e.g. GLEW) has equivalent methods. And you want to use resolvers and not go down to the platform specific again...

      这篇关于Qt 5.5和OpenGL:检索设备信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆