Environment:
VTK Branch_v9.1.0
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.39
I tested two interfaces for pick operation of vtkPropPicker on web page. The result value is awalys 0.
int vtkPropPicker::Pick(double selectionX, double selectionY, double selectionZ,
vtkRenderer *renderer) override;
int vtkPropPicker::PickProp(double selectionX, double selectionY, vtkRenderer *renderer);
Invoking code:
void Worker::OnLeftButtonDown()
{
std::cout << "OnLeftButtonDown!\n";
auto eventPos = m_RenderWindowInteractor->GetEventPosition();
int ret = m_Picker->Pick( eventPos[0], eventPos[1], 0, m_Renderer );
std::cout << "Pick: " << ret << std::endl;
ret = m_Picker->PickProp( eventPos[0], eventPos[1], m_Renderer );
std::cout << "PickProp: " << ret << std::endl;
if( ret != 0 )
{
std::cout << "picked!\n";
}
}
There are warning on browser log:
WebGL: INVALID_ENUM: readPixels: invalid format
[.WebGL-000073B40A41C000] GL_INVALID_OPERATION: Invalid format and type combination.
Maybe that’s a bug of VTK For WebAssembly. All source code has been uploaded to GitHub: https://github.com/theArcticOcean/tutorials/tree/main/learnWebAssembly/vtkPropPickerInWasm .