如何确定Qt在我的PC上使用哪个GLSL(ESSL)版本? [英] How to figure out which GLSL (ESSL) version Qt uses on my PC?

查看:534
本文介绍了如何确定Qt在我的PC上使用哪个GLSL(ESSL)版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过Qt中的Canvas3D使用 ESSL (OpenGL ES阴影语言).在我的计算机上,我运行Windows并进行了以下设置:

I'm using ESSL (OpenGL ES Shading language) via Canvas3D in Qt. On my machine I run Windows and have set the following:

QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);

中的

,这意味着GL调用由Qt转换为GL ES调用,而GL ES调用由ANGLE转换为Direct3D调用.至少我相信那是什么意思.我正在使用以下测试QML代码来查看所使用的OpenGL版本:

in main(), which means that GL calls get translated by Qt to GL ES calls, which get translated by ANGLE to Direct3D calls. At least I believe that's what it means. I'm using the following test QML code to see what OpenGL version is used:

Text {
    text: OpenGLInfo.majorVersion + "." + OpenGLInfo.minorVersion
}

这将显示"2.0".我不确定这是GL API版本还是GL ES API版本.另外,我不确定此GL/GLES版本映射到哪个ESSL版本.我找到了一个映射版本此处的表格,但这不够可靠我的来源.也不同于ESSL文档,它以无小数点格式列出ESSL版本,例如版本"330"而不是"3.3",并且缺少例如版本3.00(又名300),其中 ESSL文档提及.

This displays "2.0". I'm not sure if that's the GL API version or the GL ES API version. Also I'm not sure which ESSL version this GL/GLES version maps to. I found a table mapping the versions here but that's not a reliable enough source for me. Also unlike the ESSL docs it lists ESSL versions in a decimal-point-free format, e.g. version "330" rather than "3.3", and it lacks e.g. version 3.00 (aka 300) which the ESSL docs mention.

所以问题是:
如何确定Qt在我的PC上使用哪个ESSL版本?

So the question is:
How to figure out which ESSL version Qt uses on my PC?

我想使用textureSize ESSL函数,但是出现以下错误:

I want to use the textureSize ESSL function, but I'm getting the following error:

ERROR: 0:4: 'textureSize' : no matching overloaded function found 
ERROR: 0:4: '=' :  cannot convert from 'const float' to 'highp 2-component vector of int'

我的测试着色器如下:

uniform sampler2D uSampler;

void main(void) {
    highp ivec2 texSize = textureSize(uSampler, 0);
    gl_FragColor = vec4(0.0);
}

推荐答案

我找到了更好的方法:

gl.getString(gl.SHADING_LANGUAGE_VERSION);

但是,它似乎在Canvas3D中不起作用.参见此我的职位.

However, it doesn't seem to work in Canvas3D. See this post of mine.

这篇关于如何确定Qt在我的PC上使用哪个GLSL(ESSL)版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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