Pro OpenGL ES for iOS

(singke) #1

122 CHAPTER 4: Turning On the Lights^


Continued

Name Purpose

glNormal (^) Assigns a single normal to an array of faces
glNormalPointer (^) Specifies the current normal array for an object in the
execute method
glShadeModel (^) Either GL_FLAT or GL_SMOOTH
glPopMatrix (^) Pops a matrix off the current stack
glPushMatrix (^) Pushes a matrix on the current stack


Back to the Solar System

Now we have enough tools to get back to the solar-system project. Hold on, there is a
lot of material to cover here. In particular are some other aspects of OpenGL that have
nothing to do with lighting or materials but need to be addressed before the solar-
system model gets much more complex.
First we need to add some new method declarations and instance variables to
OpenGLSolarSystemController.h. See Listing 4-6.
Listing 4-6. Header additions to support the Solar System

#import <Foundation/Foundation.h
#import <GLKit/GLKit.h>
#import “OpenGLSolarSystem.h”
#import "Planet.h"

#define X_VALUE 0
#define Y_VALUE 1
#define Z_VALUE 2

@interface OpenGLSolarSystemController : NSObject
{
Planet *m_Earth;
Planet *m_Sun;
GLfloat m_Eyeposition[3];
}

-(void)execute;
-(void)executePlanet:(Planet *)planet;
-(id)init;
-(void)initGeometry;

@end
Free download pdf