The CCGLTouch wrapper allows the use of Cinder within a typical Cocoa project for iOS. Thus enabling C++/Obj-C creative coders in building iPhone/iPad apps that show several Cinder sketches in tabs or split views, and use UISliders, UISwitches, etc.

Its XCode templates provide the best starting points for yummy "Coco acid flavored" applications.

▸ Launching your first example project

Download the CCGLTouch examples package. Unzip the file and place the "CCGLTouch" you obtain at the root of your Cinder folder, besides "samples", "blocks", "lib"...

Within CCGLTouchBasic, open CCGLTouchBasic.xcodeproj and run it in the iPhone Simulator or on a device: the project should build and the CCGLTouchBasic app should launch with a rotating, colorful cube whose size you can adjust with a Cocoa Touch slider.


▸ Installing & using the templates

First navigate to within the Applications folder on your Mac, right-click on it and select 'Show Package Contents' from the context menu. Then take a deep breath, and place the templates' *.xctemplate that you've previously downloaded folders there:

Phew. You're ready. Launch XCode, create a new project and select the template of your choice from the iOS > Application menu. Make sure to save the project's folder inside of a folder (ie. "MyCCGLTouchProjects") at the root of your Cinder folder.

▸ A brief note about the files and their roles


Unfold all the groups in the project's hierarchy in order to get something similar to the image on the left.

In order to use the Cinder framework within a typical XCode project, it is necessary to go around the application building process that magically happens when rendering a Cinder project. This is what MyAppDelegate and the ViewController(s) are here for. The AppDelegate generates a view that is of MyCCGLView class type, and is controlled by the MyViewController.

The MyCCGLView class may bear any name you like. That is where you're going to write what's being drawn in the view. But it must inherit from the CCGLTouchView class whose .h and .mm you will find under the "CCGLTouchCore" group. Everything in that CCGLTouchCore group should remain intact unless you want to implement new functions, or tweak the defaults... at your convenience.

Finally the MyViewController class, whose .h and .mm you will find in the MyClasses group, is the place where all the Interface Builder buttons, sliders, etc. that you've added in the MyViewController.xib are being connected to the MyCinderGLView that you're controlling with them. Obviously, when using several CCGLTouchView's in the same project, all of these assets (MyCCGLView.h, MyViewController.h, MyViewController.xib) are multiplied by as many views as you'll want to use. For a simple example, check out the "CCGLTouchTabs" sample included in the package.

▸ Change log: latest additions & updated features

CCGLTouch was last updated on 03/07/2013 with:

  • Retina displays: a size_t retinaScaling parameter was added to allow choice of 1X to 2X scaling of the resolution when on a Retina device (defaults to 2X when available)
  • Previous:
  • BSD License: it is now BSD Licensed, to make things easier if you're willing to make commercial stuff with it
  • Cinder 0.84: support for the latest stable release
  • OpenGL multi-threading: support was added for OpenGL's sharegroups, that allow parallel OpenGL threads to draw to the same scene
  • Anti-aliasing: you can now set an option at setup to use Apple's brew of Multi-Sample Anti-Aliasing (MSAA) rendering for OpenGL
  • Saving to photo album: added an OpenGL frame capture method to the CCGLTouchCore classes to allow saving to the iDevice's photo album
  • Video capture example: also added an example that does "video capture" of the OpenGL frames, straight to your photo album if you will
  • Using photos from album & camera as OpenGL textures: and an example showing how to use pictures from the iDevice's photo album, or directly from the camera within the app (launched as a modal view)