May 13, 2014

OpenGL and Cocoa Framework in OSx/iOS

tutorials on OpenGL and GLKit in iOS:

Good introduction:
http://t-machine.org/index.php/2013/09/08/opengl-es-2-basic-drawing/
http://t-machine.org/index.php/2013/10/18/ios-open-gl-es-2-multiple-objects-at-once/

Simple and fast start:
http://www.raywenderlich.com/5235/beginning-opengl-es-2-0-with-glkit-part-2

http://games.ianterrell.com/opengl-basics-with-glkit-in-ios5-encapsulated-drawing-and-animation/

http://games.ianterrell.com/how-to-texturize-objects-with-glkit/

A quick summary:
http://chrismiles.info/presentations/SwipeConf-2012-OpenGL-ES-iOS5/Swipe-2012-OpenGL-ES-iOS5-Part1.pdf

Apple's own guideline to use vertex data efficiently:
https://developer.apple.com/library/ios/documentation/3ddrawing/conceptual/opengles_programmingguide/TechniquesforWorkingwithVertexData/TechniquesforWorkingwithVertexData.html


Adding custom subview:

iOS: init with storyboard
  UIStoryboard *myStoryboard = [UIStoryboard storyboardWithName:@"main"                                                           bundle:[NSBundle mainBundle]];
  
 // setup the opengl controller
    // first get an instance from storyboard
    self.glkViewController = [myStoryboard instantiateViewControllerWithIdentifier:@"glkviewcontroller"]; 
    // then add the glkview as the subview of the parent view
    [self.view addSubview: self.glkViewController.view];


Mac OS: init with nib


    SettingsViewController* settingsController = [[SettingsViewController alloc]      initWithNibName:@"SettingsViewController"
                 bundle:[NSBundle mainBundle]
           parentWidget:self
      withDefaultValues: self.graphPanel.chartType
              withColor: self.graphPanel.colorScheme

               dataType: self.attr];