Exkurs 3D configurator: Experienced developer Erik Buck, author of “Cocao Design Patterns and the upcoming Learning OpenGL ES for iOS: A Hands-on Guide to Modern 3D Graphics Programming”, spoke to InformIT senior editor Dustin Sullivan and explained how Apple`s GLKit can help them design their iOS code for optimal graphics performance with minimal effort and overhead.

was ist glkit ismail e

Sullivan: What is GLKit?

Buck: GLKit is a new framework introduced in iOS 5. It is a collection of C-functions and Objective-C-classes to simplify 3D graphics programming for iOS. To understand the role of GLKit, you need to look at it separately from the landscape.

Erhöhen Sie Ihr Verkaufsvolumen.

Mit unseren 3D-Konfiguratoren erreichen Sie mehr kommerziellen Erfolg auf Website..

iOS supports two largely incompatible libraries for hardware-accelerated 3D graphics. The first, OpenGL ES 1.1, is called “fixed-function” because it provides a fixed set of functions for generating 3D graphics. Some of these functions are very powerful and help you get basic 3D applications up and running quickly, but no finite set of functions will ever meet all requirements. In contrast, OpenGL ES 2.0 is “programmable” in the sense that custom programs written in the “C-like” OpenGL ES Shading Language can be executed directly on the Graphics Processing Unit (GPU) in iOS devices. The problem is that OpenGL ES 2.0 does not include most of these powerful features in OpenGL ES 1.1. You must write custom Shading Language programs to get the simplest graphics output.

Before GLKit, iOS application developers were faced with a critical decision: Which version of OpenGL ES should be used because porting an application from one version to another is difficult? OpenGL ES 1.1 is the past and OpenGL ES 2.0 is the future, but 1.1 offers them so many free features and 2.0 requires enormous up-front effort. OpenGL 2.0 has the potential to produce graphics faster than 1.1, but if you are a beginner in Shading Language, your own programs may run slower than the optimized 1.1 features developed and refined by experts over decades.

GLKit works regardless of whether you choose OpenGL ES 1.1 or OpenGL ES 1.1 or OpenGL ES 2.0. When you write your code to use GLKit, porting from one to another is so trivial that you may not have to change a single line of your code.

Sullivan: Is GLKit a compatibility layer?

Buck: GLKit certainly provides a compatibility layer, but it`s much more than that. It is a superior programming interface for 3D graphics. GLKit offers Objective-C classes to make programmers more productive, just like the Objective-C classes of Cocoa make programmers more productive. GLKit includes powerful reusable components. GLKit reduces the amount of code needed to write sophisticated 3D applications for scientific modeling, augmented reality, image processing, and games. I would say GLKit is on its way to becoming a complete game programming engine.

Sullivan: So does GLKit work above the level of OpenGL as Cocoa works abive the level of Apple`s old procedural Carbon framework?

Buck: In a way, that`s true. Cocoa was originally a collection of cross-platform frameworks based on the standard C Posix function library. Writing a program with Cocoa allows trivalent porting between Unix variants such as Solaris, HP-UX and OpenStep as well as Microsoft Windows. But that was never the actual reason to use the Cocoa technology. The real reason has always been to benefit from an enormous improvement in programmers` productivity. GLKit is still small and already improves the productivity of the programmers. It is easily imaginable that GLKit will develop into the cocoa of 3D graphics.

Sullivan: How does GLKit do it? How does it increase programmer productivity?

Erhöhen Sie Ihr Verkaufsvolumen.

Mit unseren 3D-Konfiguratoren erreichen Sie mehr kommerziellen Erfolg auf Website..

Buck: GLKit encapsulates and standardizes many of the basic functions that every 3D iOS application needs. For example, the GLKView class encapsulates the entire code infrastructure needed to integrate 3D graphics. It combines Cocoa, Core Animation Layers and OpenGL ES. The GLKViewController class encapsulates the entire code infrastructure needed to display updates synchonously, automatically manages resources, and provides standard iOS behaviors such as orientation changes and interruptions when a call occurs. Only these two classes eliminate hundreds of lines of code that would otherwise be recreated for each 3D application, but more importantly, they standardize behavior. the alternative is that each developer restores the expected behavior, and some will inevitably implement the behavior suboptimally or completely incorrectly.

As another example, GLKit includes a standard mathematics library for 3D graphics. These mathematical functions can be called hundreds of millions per second, so it is important that they are fast. Anyone can download a free math library from the internet, but Apple is uniquely positioned to make its library the fastest on Apple devices. By including it in GLKit, Apple takes responsibility for debugging and optimizing the library. That`s a few hundred lines of code that are no longer needed in every 3D application.

Note: GLKView, GLKViewController and the math library implement functions that do not exist in any version of OpenGL ES. GLKit has capabilities that go far beyond that.

The GLKTextureLoader class should not remain unmentioned at this point. It makes it trivial to load and configure images called “textures” to make modern 3D graphics look realistic. That`s a few hundred lines of code you don`t have to write. GLKTextureLoader uses Apple`s proven Core Graphics framework in its implementation and protects you from having to know this library as well.

Sullivan: You mentioned that GLKit is still small and can grow. How do you see the change?

Buck: For the first version of GLKit, I think Apple focused on making it easy to get a 3D application running on iOS devices. This is especially important because Apple wants developers to use OpenGL ES 2.0. GLKit eliminates one of the main reasons why developers still choose the old version 1.1. GLKit makes getting started with OpenGL ES 2.0 as easy as with 1.1.

I see GLKit migrating to Mac OS X on the desktop. I don`t know Apple`s plans, but there is no technical reason for GLKit not to work on the desktop. Developers can then exchange 3D code between iOS and Mac OS X.

Above all, Apple shows us the direction into the future. GLKit classes like GLKReflectionMapEffect and GLKSkyboxEffect offer powerful features that have long been intended for graphic asistants and game developers. GLKit implements them on a high level via OpenGL and makes them easy and accessible for everyone. Apple hardly scratched the interface. I imagine a future GLKParticle effect class, a GLKArticulatedModelEffect class and a GLKBillboardEffect. Particles, structured models and billboards are all common wizard-level 3D graphics components, such as reflections maps and skyboxes. In fact, the examples for my new book. Learning OpenGL ES for iOS: A practical guide to modern 3D graphics programming with sample implementations of particle effects, structured models, and billboards. The examples show graphical concepts explained in the book and implement some of the example mini-games in the book. I hope and assume that the samples anticipate Apple`s intentions. At least for me they seemed to be obvious extensions of GLKit.

Erhöhen Sie Ihr Verkaufsvolumen.

Mit unseren 3D-Konfiguratoren erreichen Sie mehr kommerziellen Erfolg auf Website..

Sullivan: Iy our new book about GLKit? Does it expand Apple`s documentation?

Buck: The book is about modern 3D graphics programming for iOS devices. It`s for programmers who want to learn 3D graphics from the ground up. It`s really about GLKit, but GLKit is now the most modern and powerful way to use 3D graphics. The book uses GLKit classes and functions as a guide through the associated 3D programming concepts. Some GLKit features are partially reimplemented in examples to illustrate the underlying technologies and concepts. After reading the book, you will not only know how to use GLKit, but also how to implement it.