# Shader compilation issue

**URL:** https://discourse.vtk.org/t/shader-compilation-issue/7008
**Category:** Support
**Created:** [October 28, 2021, 9:59pm UTC](https://discourse.vtk.org/t/shader-compilation-issue/7008 "2021-10-28T21:59:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![nickc](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/n/47e85d/32.png) [@nickc](https://discourse.vtk.org/u/nickc)
#### Post date: [October 28, 2021, 9:59pm UTC](https://discourse.vtk.org/t/shader-compilation-issue/7008/1 "2021-10-28T21:59:13Z")

</div>

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:

```auto
Fragment error "ERROR: 0:3: '' : #version required and missing.\n"

```

The error I get when I try to manually add a version:

```auto
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:

```auto
      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:

```auto
  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:

```auto
//VTK::System::Dec
//VTK::Output::Dec

precision mediump float;

in vec4 InputColor;
out vec4 FragColor;

void main() {          
	FragColor = InputColor;
}

```

Some specs on my system:

```auto
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!
