0

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);

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
}

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.

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

Side note - what prompted my question:

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'

My test shader looks like this:

uniform sampler2D uSampler;

void main(void) {
    highp ivec2 texSize = textureSize(uSampler, 0);
    gl_FragColor = vec4(0.0);
}
Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Stefan Monov
  • 11,332
  • 10
  • 63
  • 120

2 Answers2

0

I found a roundabout way to do it. Did the following in the shader:

if(__VERSION__  > 150) {
    gl_FragColor = vec4(1.0, 0.0. 0.0, 1.0);
}

And play with the number 150 to find when it draws red and when not.

That way's not great though.

Stefan Monov
  • 11,332
  • 10
  • 63
  • 120
0

I found a better way:

gl.getString(gl.SHADING_LANGUAGE_VERSION);

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

Community
  • 1
  • 1
Stefan Monov
  • 11,332
  • 10
  • 63
  • 120