mirror of https://github.com/axmolengine/axmol.git
Add destructor for CCGLBufferedNode class to delete GL buffers.
This commit is contained in:
parent
6b8966e575
commit
09bc00032c
|
@ -24,7 +24,7 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCGLBufferedNode.h"
|
||||
|
||||
CCGLBufferedNode::CCGLBufferedNode(void)
|
||||
CCGLBufferedNode::CCGLBufferedNode()
|
||||
{
|
||||
for(int i = 0; i < BUFFER_SLOTS; i++)
|
||||
{
|
||||
|
@ -35,6 +35,21 @@ CCGLBufferedNode::CCGLBufferedNode(void)
|
|||
}
|
||||
}
|
||||
|
||||
CCGLBufferedNode::~CCGLBufferedNode()
|
||||
{
|
||||
for(int i = 0; i < BUFFER_SLOTS; i++)
|
||||
{
|
||||
if(m_bufferSize[i])
|
||||
{
|
||||
glDeleteBuffers(1, &(m_bufferObject[i]));
|
||||
}
|
||||
if(m_indexBufferSize[i])
|
||||
{
|
||||
glDeleteBuffers(1, &(m_indexBufferObject[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCGLBufferedNode::setGLBufferData(void *buf, GLuint bufSize, int slot)
|
||||
{
|
||||
// WebGL doesn't support client-side arrays, so generate a buffer and load the data first.
|
||||
|
|
|
@ -24,12 +24,13 @@ THE SOFTWARE.
|
|||
#ifndef __CC_GL_BUFFERED_NODE__
|
||||
#define __CC_GL_BUFFERED_NODE__
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
#include <CCGL.h>
|
||||
|
||||
class CCGLBufferedNode
|
||||
{
|
||||
public:
|
||||
CCGLBufferedNode(void);
|
||||
CCGLBufferedNode();
|
||||
virtual ~CCGLBufferedNode();
|
||||
|
||||
/**
|
||||
* Load the given data into this CCNode's GL Buffer. Needed for WebGL, as it does not support client-side arrays.
|
||||
|
|
Loading…
Reference in New Issue