CHAPTER 8: Putting It All Together (^273)
-(void)execute:(BOOL)constOutlinesOn names:(BOOL)constNamesOn
{
[m_Outlines execute: constOutlinesOn showNames: constNamesOn];
[m_Stars execute];
}
@end
Not much to that one. So, let’s go on to the star object itself, as shown in Listings 8-13a,
8-13b, and 8-13c. This will use a method of data ‘‘interleaving’’ that Apple recommends
for the purpose of increasing performance.
Listing 8-13a. The Star Container header
#import <Foundation/Foundation.h>
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
struct starData //1
{
GLfloat x;
GLfloat y;
GLfloat z;
GLfloat mag;
GLfloat r,g,b,a;
GLint hdnum;
};
@interface OpenGLStars : NSObject
{
struct starData m_Data;
int m_TotalStars;
}
-(void)execute;
-(void)init:(NSString )filename;
-(id)init;
@end
Listing 8-13b. The Star Container body
#import "OpenGLUtils.h"
#import "OpenGLSolarSystem.h"
#import "OpenGLStars.h"
#import "miniGLU.h"
@implementation OpenGLStars
- (id)init
{
self = [super init];