0

How can I use this Mac OS X render library in my iOS app? I know that it can be done but I don't know how. I don't need code examples but if someone could describe essentially what I would have to do to first get this running and displaying a render in an iOS app.

genpfault
  • 51,148
  • 11
  • 85
  • 139
harryisaac
  • 1,121
  • 1
  • 10
  • 18

1 Answers1

0

For one, you'll need to completely rewrite stl_viewer.c to not use immediate mode (glVertex3f(), etc.) and instead store your geometry as vertices or indices that are drawn to the screen as unified objects. That will be quite a bit of work for this sample code.

This will also need to be restructured to use a CAEAGLLayer-backed UIView and to respond to touch events instead of the input loop it currently uses.

In short, if you're not familiar with OpenGL and OpenGL ES and the difference between them, this will be a challenge for you.

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
  • It was not hard at all actually, I just took the part of the code in stl_viewer.c that gets the vertices from the STL and dropped it into the OpenGL view the is created when creating an OpenGL ES app in Xcode. – harryisaac Aug 02 '13 at 18:59
  • @harry1795671 - Um, I don't see how that would work at all. `glBegin()`, `glEnd()`, etc. don't even exist in OpenGL ES, so none of that code would work there. It's possible you were able to link against OpenGL on the desktop for the Simulator, but if you try to run this on an actual iOS device it will fail. – Brad Larson Aug 02 '13 at 19:02