I’m really don’t know what I am doing when it comes to OpenGL and OpenGL Shader and all of that but I have a custom piece of code that was written for us:
std::string FSSource = shaders[vtkShader::Fragment]->GetSource();
vtkShaderProgram::Substitute(FSSource, "//VTK::Picking::Impl",
"//DREAM3D-NX::Picking::Impl\n"
" ivec2 size = textureSize(actortexture,0);\n"
" vec2 fsize = vec2(size);\n"
" vec2 fcoord = tcoordVCVSOutput * fsize;\n"
" ivec2 coord = ivec2(fcoord);\n"
" int idx = coord.y * size.x + coord.x;\n"
" fragOutput0 = vec4(double(idx % 256) / 255.0, double((idx / 256) % 256) / 255.0, double((idx / 65536) % 256) / 255.0, 1.0);\n");
shaders[vtkShader::Fragment]->SetSource(FSSource);
and the issue is that somewhere in that code we are overflowing at 24 bits for the ‘idx’ calculation. I have tried to use dvec2
but that just throws errors about reserved words.
What version of OpenGL Shader Language does Vtk 9.2.6 use? Would it be any better with a newer version of VTK?
How could I adjust the code to allow for the proper calculation of the “idx” variable without over flowing the 24 bit of precision.
Thanks.