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
OpenGL 3.3 and the shaders errors #1
Comments
Thanks for the feedback! It seems that Qt's own shaders don't contain the correct GLSL version information, and with OpenGL 3.3, the standard requires this. Currently both Qt's own shaders and mine are being compiled (and I think they both have to in order for other 3D objects to be shown together with the billboards). What hardware are you using? I'm guessing you might have an AMD graphics card, because I have not seen this error on any cards from NVIDIA. I'll look into providing a solution so that you can easily disable OpenGL 3.3 for now. In the meantime, change the following two lines in main.cpp
to
This will use OpenGL 2.3 without the geometry shader |
I'm using an AMD 7660D (APU) with the fglrx drivers on OpenSuse 13.1 which should support OpenGL 4.3. It works perfectly using OpenGL 2.3 though not with geometry shaders rendering. |
Yes, then that's definitely it. AMD probably enforces the standard more strictly. It's strange though, that there's not even a warning with NVIDIA. Or perhaps Qt3D doesn't show warnings unless there also are some errors. I'm looking forward to see the rewrite of Qt3D. Let's hope it's fixed then :) |
Hey there,
I just tried your new version and unfortunately it ends with a segfault on my pc.
I don't know since which commit the issue started to appear, but a few months back it wasn't there.
There seems to be some king of error with OpenGL 3.3 and the shaders.
Anyway, nothing urgent but you might want to look at it sometime.
Below is my log output :
Showing a total of 343000 points.
QSGContext::initialize: stencil buffer support missing, expect rendering errors
QOpenGLShader::compile(Vertex): Vertex shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors. No code generated
*** Problematic Vertex shader source code ***
define lowp
define mediump
define highp
Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile
QOpenGLShader::compile(Fragment): Fragment shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors. No code generated
*** Problematic Fragment shader source code ***
define lowp
define mediump
define highp
Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile
QOpenGLShader::link: "Vertex and Fragment shader(s) were not successfully compiled before glLinkProgram() was called. Link failed.
"
Errors linking simple shader: Vertex and Fragment shader(s) were not successfully compiled before glLinkProgram() was called. Link failed.
QOpenGLShader::compile(Vertex): Vertex shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors. No code generated
*** Problematic Fragment shader source code ***
define lowp
define mediump
define highp
return texture2D(imageTexture, textureCoords);
}
Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile
QOpenGLShader::link: "Vertex and Fragment shader(s) were not successfully compiled before glLinkProgram() was called. Link failed.
"
Errors linking blit shader: Vertex and Fragment shader(s) were not successfully compiled before glLinkProgram() was called. Link failed.
QOpenGLShader::compile(Fragment): Fragment shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors. No code generated
*** Problematic Fragment shader source code ***
define lowp
define mediump
define highp
Warning: "" failed to compile!
QOpenGLShader::compile(Vertex): Vertex shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors. No code generated
*** Problematic Fragment shader source code ***
define lowp
define mediump
define highp
Warning: "" failed to compile!
QOpenGLShader::compile(Vertex): Vertex shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors. No code generated
*** Problematic Vertex shader source code ***
define lowp
define mediump
define highp
uniform mediump vec3 sdli;
uniform mediump vec3 pli;
uniform mediump float pliw;
uniform mediump float srli;
uniform mediump float crli;
uniform mediump float ccrli;
uniform mediump float k0;
uniform mediump float k1;
uniform mediump float k2;
uniform mediump vec4 acm[2];
uniform mediump vec4 dcm[2];
uniform mediump vec4 scm[2];
uniform mediump vec4 ecm[2];
uniform mediump float srm[2];
uniform bool viewerAtInfinity;
uniform bool twoSided;
varying mediump vec4 qColor;
varying mediump vec4 qSecondaryColor;
void qLightVertex(vec4 vertex, vec3 normal)
{
int i, material;
vec3 toEye, toLight, h;
float angle, spot, attenuation;
vec4 color, scolor;
vec4 adcomponent, scomponent;
if (!twoSided || normal.z >= 0.0) {
material = 0;
} else {
material = 1;
normal = -normal;
}
color = ecm[material];
scolor = vec4(0, 0, 0, 0);
if (viewerAtInfinity)
toEye = vec3(0, 0, 1);
else
toEye = normalize(-vertex.xyz);
if (pliw == 0.0)
toLight = normalize(pli);
else
toLight = normalize(pli - vertex.xyz);
angle = max(dot(normal, toLight), 0.0);
adcomponent = acm[material] + angle * dcm[material];
if (angle != 0.0) {
h = normalize(toLight + toEye);
angle = max(dot(normal, h), 0.0);
if (srm[material] != 0.0)
scomponent = pow(angle, srm[material]) * scm[material];
else
scomponent = scm[material];
} else {
scomponent = vec4(0, 0, 0, 0);
}
if (crli != 180.0) {
spot = max(dot(normalize(vertex.xyz - pli), sdli), 0.0);
if (spot < ccrli) {
adcomponent = vec4(0, 0, 0, 0);
scomponent = vec4(0, 0, 0, 0);
} else {
spot = pow(spot, srli);
adcomponent *= spot;
scomponent *= spot;
}
}
if (pliw != 0.0) {
attenuation = k0;
if (k1 != 0.0 || k2 != 0.0) {
float len = length(pli - vertex.xyz);
attenuation += k1 * len + k2 * len * len;
}
color += adcomponent / attenuation;
scolor += scomponent / attenuation;
} else {
color += adcomponent;
scolor += scomponent;
}
float alpha = dcm[material].a;
qColor = vec4(clamp(color.rgb, 0.0, 1.0), alpha);
qSecondaryColor = clamp(scolor, 0.0, 1.0);
}
attribute highp vec4 vertex;
attribute highp vec3 normal;
attribute highp vec4 texcoord;
uniform highp mat4 matrix;
uniform highp mat4 modelView;
uniform highp mat3 normalMatrix;
varying highp vec4 qt_TexCoord0;
void main(void)
{
gl_Position = matrix * vertex;
highp vec4 tvertex = modelView * vertex;
highp vec3 norm = normalize(normalMatrix * normal);
qLightVertex(tvertex, norm);
qt_TexCoord0 = texcoord;
}
QOpenGLShader::compile(Fragment): Fragment shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors. No code generated
*** Problematic Fragment shader source code ***
define lowp
define mediump
define highp
uniform sampler2D tex;
uniform bool separateSpecular;
varying mediump vec4 qColor;
varying mediump vec4 qSecondaryColor;
varying highp vec4 qt_TexCoord0;
void main(void)
{
mediump vec4 col = texture2D(tex, qt_TexCoord0.st);
if (separateSpecular) {
gl_FragColor = clamp(col * qColor + vec4(qSecondaryColor.xyz, 0.0), 0.0, 1.0);
} else {
mediump vec4 lcolor = clamp(qColor + vec4(qSecondaryColor.xyz, 0.0), 0.0, 1.0);
gl_FragColor = col * lcolor;
}
}
QOpenGLShader::link: "Error: No shaders attached to current program
"
QGLLitMaterialEffect::setActive(): could not link shader program
Effect set from QML, should copy properties
MultiBillboard: OpenGL version 3 . 3
The text was updated successfully, but these errors were encountered: