1
0
mirror of https://github.com/thes3m/XNI synced 2024-12-26 13:26:06 +01:00

Fixed buffers that didn't clean up after themselves.

git-svn-id: http://xni.googlecode.com/svn/XNI@123 ac433895-eea3-a490-d80a-17149a75e588
This commit is contained in:
Matej Jan 2012-10-23 21:03:00 +00:00
parent 0b5b46e937
commit 9c8ed11ac6
4 changed files with 12 additions and 1 deletions

View File

@ -22,7 +22,8 @@
- (uint) createBuffer; - (uint) createBuffer;
- (void) setData:(void*)data toIndexBuffer:(IndexBuffer*)buffer; - (void) setData:(void*)data toIndexBuffer:(IndexBuffer*)buffer;
- (void) setData:(void*)data toVertexBuffer:(VertexBuffer*)buffer; - (void) setData:(void*)data toVertexBuffer:(VertexBuffer*)buffer;
- (void) releaseBuffer:(uint)bufferId;
// Profile specific // Profile specific
- (EAGLContext*) createContext; - (EAGLContext*) createContext;

View File

@ -408,6 +408,9 @@
glBindBuffer(resourceType, 0); glBindBuffer(resourceType, 0);
} }
- (void)releaseBuffer:(uint)bufferId {
glDeleteBuffers(1, &bufferId);
}
// Profile specific // Profile specific

View File

@ -39,5 +39,11 @@
[graphicsDevice setData:data.array toIndexBuffer:self]; [graphicsDevice setData:data.array toIndexBuffer:self];
} }
- (void)dealloc
{
[graphicsDevice releaseBuffer:bufferID];
[super dealloc];
}
@end @end

View File

@ -41,6 +41,7 @@
- (void) dealloc - (void) dealloc
{ {
[graphicsDevice releaseBuffer:bufferID];
[vertexDeclaration release]; [vertexDeclaration release];
[super dealloc]; [super dealloc];
} }