Hi all,
I apologize in advance - I’m not a VTK / GLSL expert.
I am running into a compilation issue with a Qt5.6 project using VTK 8.0 on MacOS 10.15.7. I’m getting version errors every time I try to call the Compile function on my shaders. I have been using the “//VTK::System::Dec” tag to automatically add the version tag, but I have also tried to manually add it with no success. This code / shader works on a Windows system with the same VTK/Qt combo.
The error I get with the System::Dec tag:
Fragment error "ERROR: 0:3: '' : #version required and missing.\n"
The error I get when I try to manually add a version:
Fragment error "ERROR: 0:1: '' : version '300' is not supported\nERROR: 0:1: '' : syntax error: #version\nERROR: 0:2: '' : #version required and missing.\n"
My dummy code looks like this:
vtkShaderProgram *sps = vtkShaderProgram::New();
sps->GetVertexShader()->SetSource(vertexShader);
sps->GetFragmentShader()->SetSource(fragmentShader);
//sps->GetFragmentShader()->SetDebug(true);
sps->GetFragmentShader()->Compile();
std::string error = sps->GetFragmentShader()->GetError();
qDebug() << "Fragment error" << QString::fromStdString(error);
sps->GetVertexShader()->Compile();
std::string vertexError = sps->GetVertexShader()->GetError();
qDebug() << "Vertex error" << QString::fromStdString(vertexError);
Then later we call:
this->Impl->ShaderProgram = this->Impl->ShaderCache->ReadyShaderProgram(
vertexShader.c_str(), fragmentShader.c_str(), "");
Which right now returns an empty pointer. (Is there a way to grab the error from there as well?)
And my dummy fragment shader looks like this:
//VTK::System::Dec
//VTK::Output::Dec
precision mediump float;
in vec4 InputColor;
out vec4 FragColor;
void main() {
FragColor = InputColor;
}
Some specs on my system:
OpenGL version: "2.1 ATI-3.10.18"
Vendor: "ATI Technologies Inc."
Hardware: "AMD Radeon Pro 555X OpenGL Engine"
Am I missing something to activate the automatic parsing or any sort of compilation in VTK?
In info would be appreciated.
Thanks!