has anyone gotten the iOS examples to work recently?

I’ve read the instructions on building vtk.framework for IOS and am able to do that. However, whenever I try to build the sample applications, I quickly get stuck on things like:

vtkRenderingOpenGL2ObjectFactory.h. (missing file)
or identifiers like vtkRenderingOpenGL2ObjectFactory not being found.

Following a post, I did this to build:
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_FRAMEWORK_INSTALL_PREFIX=/Users/deb/frameworks -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DVTK_IOS_BUILD=ON -DModule_vtkFiltersModeling=ON …/source

but just can’t get past this.

Any leads?

It looks like OpenGL is not supported.

Ah. Well, for iOS, is there an alternative? I don’t suppose someone has ported VTK for iOS to metal…

So nobody is able to use VTK on iOS these days?

Can anyone suggest opensource code that could, without heroic effort, let me render in near-real-time volumetric data from DICOM files, on iOS?

VTK on iOS relies on OpenGL ES like WASM.

Could some tell me either : “no” it is no longer possible to build VTK or iOS, or “yes” it is, you just need to set these flags answer?

As far as I know OpenGL is deprecated on iOS, but still exists.

Yes, it should be possible to build. Pass -DVTK_OPENGL_USE_GLES=ON when configuring VTK. It should automatically happen, looks like this is not the case right now.

Hope that works.

Thank you! I will give that a try.

I was asking the wrong question as it turns out. Building the vtk framework for iOS wasn’t really the issue; the problem is trying to compile the sample program VTKViewer which is included as an example program. And quite possibly VTK_OPENGL_USE_GLES=on is happening. Because like I said it’s not an issue with the framework: it is the sample programs which are hardcoded to use OpenGL2, I guess?

For example, in VTKViewer/VTKView.m, we see the line
#include “vtkRenderingOpenGL2ObjectFactory.h”

so it would seem this example program explicitly depends on OpenGL2 as oppposed to OPENGL_GLES.

Same for the VolumeRender example directory: in MyGLKViewController we see:

#include “vtk/vtkRenderingOpenGL2ObjectFactory.h”


It’s great that I can build the VTK framework for iOS; but without an example program (which I seriously doubt I would be able to write on my own), I can’t know that this really still working. Is there any updated iOS example programs somewhere someone could point me to?

well, that is alright. The OpenGL2 module serves classes even for OpenGL ES. I think something else is off here.

All I know is that that include file is just nowhere to be found. Is that generated by the build? Or it an authored source file which should exist somewhere?

It’s generated while configuring VTK with CMake.

OK, well, I’m happy to try any other build flags someone might suggest, not sure what I am missing getting it to build these headers so I can try the examples.

If it helps, I see this in the build directory:
Debonair$ find . -name vtkRenderingOpenGL2ObjectFactory.h
./CMakeExternals/Build/vtk-ios-device-arm64/Rendering/OpenGL2/vtkRenderingOpenGL2ObjectFactory.h

But not in the final framework:
find vtk.framework -name vtkRenderingOpenGL2ObjectFactory.h

So it looks like the build created the file, but isn’t putting it in the right (or any, really) location in the final product?

I wonder if it is fixed by https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9541. @timt or @svenevs might know what is necessary to get it working.

1 Like

I tried building directly from the fork that has that merge request. That fork doesn’t build for me either. (And what I mean is that the framework builds, but the examples don’t. Once again, vtkRenderingOpenGL2ObjectFactory.h is missing.)

WBN if vtk could work again for iOS. If anyone ever comes back to this thread with an answer, please let me know.