This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Create a single sphere, with texture | |
| - (void)setupTexturedSphere | |
| { | |
| // We need an earth texture | |
| NSError *error = nil; | |
| NSString *filePath = [[NSBundle mainBundle] pathForResource:@"NaturalEarth" ofType:@"tif"]; | |
| texture = [GLKTextureLoader textureWithContentsOfFile:filePath options:nil error:&error]; | |
| // A single cube, centered at the origin | |
| float origin[3] = {0,0.5,0}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Number of samples in each direction | |
| static const int LongitudeSample=20,LatitudeSample=10; | |
| - (void)addSphereAt:(float *)org sized:(float *)size | |
| { | |
| // We'll generate the coordinates and normals ahead of time | |
| float coords[3*LongitudeSample*LatitudeSample]; | |
| float norms[3*LongitudeSample*LatitudeSample]; | |
| float texCoords[2*LongitudeSample*LatitudeSample]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.m | |
| // NSMeetupExample | |
| // | |
| // Created by sjg@mousebirdconsulting.com on 8/6/13. | |
| // | |
| #import "ViewController.h" | |
| #import "SimpleGLObject.h" | |
| #import "FlexiVertexBuffer.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // FlexiVertexBuffer.m | |
| // NSMeetupExample | |
| // | |
| // Created by sjg@mousebirdconsulting.com on 8/6/13. | |
| // | |
| #import "FlexiVertexBuffer.h" | |
| GLfloat gCubeVertexData[216] = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // FlexiVertexBuffer.h | |
| // NSMeetupExample | |
| // | |
| // Created by sjg@mousebirdconsulting.com on 8/6/13. | |
| // | |
| #import <UIKit/UIKit.h> | |
| #import "SimpleGLObject.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // SimpleGLObject.m | |
| // NSMeetupExample | |
| // | |
| // Created by sjg@mousebirdconsulting.com on 8/6/13. | |
| // | |
| #import "SimpleGLObject.h" | |
| #import <GLKit/GLKit.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // SimpleGLObject.h | |
| // NSMeetupExample | |
| // | |
| // Created by sjg@mousebirdconsulting.com on 8/6/13. | |
| // | |
| #import <UIKit/UIKit.h> | |
| /* A wrapper around the data we need to draw a single |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.m | |
| // NSMeetupExample | |
| // | |
| // Created by sjg@mousebirdconsulting.com on 8/6/13. | |
| // | |
| #import "ViewController.h" | |
| #import "SimpleGLObject.h" | |
| #import "FlexiVertexBuffer.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* A wrapper around the data we need to draw a single | |
| OpenGL ES related object. | |
| */ | |
| @interface SimpleGLObject : NSObject | |
| // The buffer in OpenGL driver space containing the vertices | |
| @property GLuint vertexBuffer; | |
| // Vertex arrays contain the state to draw our object | |
| @property GLuint vertexArray; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MaplyPlateCarree *coordSys = [[MaplyPlateCarree alloc] initFullCoverage]; | |
| MaplyWMSTileSource *tileSource = [[MaplyWMSTileSource alloc] initWithBaseURL:@"http://raster.nationalmap.gov/ArcGIS/services/Orthoimagery/USGS_EDC_Ortho_NAIP/ImageServer/WMSServer" layers:@[@"0"] coordSys:coordSys minZoom:0 maxZoom:16 tileSize:256]; | |
| tileSource.transparent = true; | |
| MaplyQuadEarthTilesLayer *layer = [[MaplyQuadEarthTilesLayer alloc] initWithCoordSystem:coordSys tileSource:tileSource]; | |
| layer.handleEdges = true; | |
| layer.cacheDir = thisCacheDir; | |
| [baseViewC addLayer:layer]; |