# has anyone gotten the iOS examples to work recently?

**URL:** https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673
**Category:** Support
**Created:** [April 5, 2024, 1:22am UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673 "2024-04-05T01:22:52Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![davidbaraff](https://discourse.vtk.org/user_avatar/discourse.vtk.org/davidbaraff/32/8705_2.png) [@davidbaraff](https://discourse.vtk.org/u/davidbaraff)
#### Post date: [April 5, 2024, 1:22am UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/1 "2024-04-05T01:22:52Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [April 6, 2024, 3:06am UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/2 "2024-04-06T03:06:40Z")

</div>

It looks like OpenGL is not supported.

---

<div class="post-metadata">

### Author: ![davidbaraff](https://discourse.vtk.org/user_avatar/discourse.vtk.org/davidbaraff/32/8705_2.png) [@davidbaraff](https://discourse.vtk.org/u/davidbaraff)
#### Post date: [April 6, 2024, 3:11am UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/3 "2024-04-06T03:11:39Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [April 6, 2024, 5:54pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/4 "2024-04-06T17:54:04Z")

</div>

VTK on iOS relies on OpenGL ES like WASM.

---

<div class="post-metadata">

### Author: ![davidbaraff](https://discourse.vtk.org/user_avatar/discourse.vtk.org/davidbaraff/32/8705_2.png) [@davidbaraff](https://discourse.vtk.org/u/davidbaraff)
#### Post date: [April 6, 2024, 6:06pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/5 "2024-04-06T18:06:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [April 6, 2024, 8:42pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/6 "2024-04-06T20:42:45Z")

</div>

> [@davidbaraff](#):
>
> 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?

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.

---

<div class="post-metadata">

### Author: ![davidbaraff](https://discourse.vtk.org/user_avatar/discourse.vtk.org/davidbaraff/32/8705_2.png) [@davidbaraff](https://discourse.vtk.org/u/davidbaraff)
#### Post date: [April 6, 2024, 9:53pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/7 "2024-04-06T21:53:53Z")

</div>

Thank you! I will give that a try.

---

<div class="post-metadata">

### Author: ![davidbaraff](https://discourse.vtk.org/user_avatar/discourse.vtk.org/davidbaraff/32/8705_2.png) [@davidbaraff](https://discourse.vtk.org/u/davidbaraff)
#### Post date: [April 12, 2024, 7:08pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/8 "2024-04-12T19:08:13Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [April 12, 2024, 7:10pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/9 "2024-04-12T19:10:10Z")

</div>

> [@davidbaraff](#):
>
> so it would seem this example program explicitly depends on OpenGL2 as oppposed to OPENGL\_GLES.

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

---

<div class="post-metadata">

### Author: ![davidbaraff](https://discourse.vtk.org/user_avatar/discourse.vtk.org/davidbaraff/32/8705_2.png) [@davidbaraff](https://discourse.vtk.org/u/davidbaraff)
#### Post date: [April 12, 2024, 7:11pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/10 "2024-04-12T19:11:54Z")

</div>

> [@davidbaraff](#):
>
> vtk/vtkRenderingOpenGL2ObjectFactory.h

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?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [April 12, 2024, 7:12pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/11 "2024-04-12T19:12:52Z")

</div>

It’s generated while configuring VTK with CMake.

---

<div class="post-metadata">

### Author: ![davidbaraff](https://discourse.vtk.org/user_avatar/discourse.vtk.org/davidbaraff/32/8705_2.png) [@davidbaraff](https://discourse.vtk.org/u/davidbaraff)
#### Post date: [April 12, 2024, 7:14pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/12 "2024-04-12T19:14:01Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![davidbaraff](https://discourse.vtk.org/user_avatar/discourse.vtk.org/davidbaraff/32/8705_2.png) [@davidbaraff](https://discourse.vtk.org/u/davidbaraff)
#### Post date: [April 12, 2024, 8:22pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/13 "2024-04-12T20:22:52Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [April 12, 2024, 8:25pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/14 "2024-04-12T20:25:49Z")

</div>

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

---

<div class="post-metadata">

### Author: ![davidbaraff](https://discourse.vtk.org/user_avatar/discourse.vtk.org/davidbaraff/32/8705_2.png) [@davidbaraff](https://discourse.vtk.org/u/davidbaraff)
#### Post date: [April 16, 2024, 5:21pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/15 "2024-04-16T17:21:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![totte\_karlsson](https://discourse.vtk.org/user_avatar/discourse.vtk.org/totte_karlsson/32/4281_2.png) [@totte\_karlsson](https://discourse.vtk.org/u/totte_karlsson)
#### Post date: [July 28, 2026, 7:36pm UTC](https://discourse.vtk.org/t/has-anyone-gotten-the-ios-examples-to-work-recently/13673/16 "2026-07-28T19:36:10Z")

</div>

I’m looking into going this route. Did you have any success?
