Assuming you want to pass in additional light positions to the vertex shader (outside of the lights provided by the fixed functional pipeline) I am not seeing these additional uniforms functioning correctly.
For example in my vertex shader I have:
...
uniform vec3 light_pos;
...
varying vec3 frag_light_pos;
void main() {
...
frag_light_pos = vec3(0.0f, 100.0f, 0.0f);
//frag_light_pos = light_pos;
...
}
Where the difference in my scene can be seen below.
To set the uniform variable I am using Qt's QOpenGLShaderProgam::setUniformValue in the following manner.
QVector3D light_pos(0.0f, 100.0f, 0.0f);
m_ShaderProgram->setUniformValue("light_pos", light_pos);
All my other uniforms, the mv, mvp, and (trans(mv))^-1 all work so it is not a problem with Qt. Where am I going wrong? I would expect to see the same image using either version.
Screenshot using const vec3:
Screenshot using uniform vec3:
Aucun commentaire:
Enregistrer un commentaire