Каков наилучший способ освобождения памяти в OpenGL ES? - PullRequest
0 голосов
/ 27 июня 2011
@interface EAGLView1 : UIView<UIAlertViewDelegate> {

@private
/* The pixel dimensions of the backbuffer */
GLint backingWidth;
GLint backingHeight;
GLfloat transY;
GLint check;
EAGLContext *context;
GLint shipMover;
GLint shipMover2;
/* OpenGL names for the renderbuffer and framebuffers used to render to this view */
GLuint viewRenderbuffer, viewFramebuffer;

/* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists     (0 if it does not exist) */
GLuint depthRenderbuffer;

NSTimer *animationTimer;
NSTimeInterval animationInterval;

CFTimeInterval lastTime;

Image *playerShip;
Texture2D *PlayerShip2;
Image *background;
Image *motherShip;
Image *motherShip2;
Image *bgLight;
Image *spaceShip1;
Image *spaceShip2;
GLint ship2check;
GLfloat ship2y;
GLfloat firex,firey;
GLint shipMinus;

GLint fireHitter;
GLint backCounter;
GLint bgCheck;
GLint shipy;
GLfloat motherShipx;
GLfloat motherShipx2;
GLint ship1x,ship2x,ship3x;
GLint shipCounter1;
GLint fireCheck;
Image *fire;
GLfloat playerx;
GLint shipBreaker;

NSMutableArray *bricksArray;    
Image *explosion;
AVAudioPlayer *player;
NSMutableArray *allShips;
NSMutableArray *createdShips;
GLint shipCounter;
GLint levelCounter;
NSMutableArray *fireArray;
GLint shipD;
GLint expPosition;
GLint motherShipy; 
NSMutableArray *dBricks;
GLint shipBreak;
GLint leveler;
Image *scoreImage;
GLint scoreCounter;
GLboolean isLevel;
Image *levelImage;
GLboolean isGameOver;
Image *gameOverImage;
GLint bonus;
GLboolean leftClear;
GLint shipHitter;
GLint strRemover;
Image *lifeBar;
Image *topBar;
NSMutableArray* barArray;
GLboolean isStared;
NSMutableArray *shipFire;
GLint speedCheck;
GLint levelIndicates;

}

@property(nonatomic,retain)NSMutableArray *shipFire;
@property(nonatomic)float motherShipx2;
@property(nonatomic,retain)Image *motherShip2;
@property(nonatomic)GLboolean isStarted;
@property(nonatomic)GLint scoreCounter;
@property(nonatomic,retain)NSMutableArray *barArray;
@property(nonatomic,retain)Image *topBar;
@property(nonatomic)GLint leveler;
@property(nonatomic,retain)Image *lifeBar;
@property(nonatomic)GLint shipD;
@property(nonatomic,retain)Image *gameOverImage;
@property(nonatomic)GLboolean isLevel;
@property(nonatomic) GLboolean isGameOver; 
@property(nonatomic,retain)Image *levelImage;
@property(nonatomic,retain)Image *scoreImage; 
@property(nonatomic,retain)NSMutableArray *dBricks;
@property(nonatomic,retain)NSMutableArray *fireArray;
@property(nonatomic,retain)NSMutableArray *createdShips;
@property(nonatomic,retain)NSMutableArray *bricksArray;
@property(nonatomic,retain)AVAudioPlayer *player;
@property(nonatomic,retain)NSMutableArray *allShips;

Теперь предположим, что после завершения игры у меня есть такие объекты, где мне их освободить или очистить память до кучи?

1 Ответ

1 голос
/ 27 июня 2011

Выпуск всех ваших alloced и retained объектов в функции dealloc вашего класса.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...