mirror of https://github.com/axmolengine/axmol.git
put '{' in a new line to follow cocos2d-x coding style
This commit is contained in:
parent
3b9348bfc0
commit
2687ee8915
|
@ -115,7 +115,8 @@ DrawNode::~DrawNode()
|
|||
glDeleteBuffers(1, &_vbo);
|
||||
_vbo = 0;
|
||||
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
glDeleteVertexArrays(1, &_vao);
|
||||
GL::bindVAO(0);
|
||||
_vao = 0;
|
||||
|
@ -160,7 +161,8 @@ bool DrawNode::init()
|
|||
|
||||
ensureCapacity(512);
|
||||
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
glGenVertexArrays(1, &_vao);
|
||||
GL::bindVAO(_vao);
|
||||
}
|
||||
|
@ -180,7 +182,8 @@ bool DrawNode::init()
|
|||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
GL::bindVAO(0);
|
||||
}
|
||||
|
||||
|
@ -207,10 +210,12 @@ void DrawNode::render()
|
|||
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacity, _buffer, GL_STREAM_DRAW);
|
||||
_dirty = false;
|
||||
}
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
GL::bindVAO(_vao);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||
|
|
|
@ -58,10 +58,12 @@ bool ParticleSystemQuad::initWithTotalParticles(unsigned int numberOfParticles)
|
|||
}
|
||||
|
||||
initIndices();
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
setupVBOandVAO();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
setupVBO();
|
||||
}
|
||||
|
||||
|
@ -95,7 +97,8 @@ ParticleSystemQuad::~ParticleSystemQuad()
|
|||
CC_SAFE_FREE(_quads);
|
||||
CC_SAFE_FREE(_indices);
|
||||
glDeleteBuffers(2, &_buffersVBO[0]);
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
glDeleteVertexArrays(1, &_VAOname);
|
||||
GL::bindVAO(0);
|
||||
}
|
||||
|
@ -355,7 +358,8 @@ void ParticleSystemQuad::draw()
|
|||
|
||||
CCASSERT( _particleIdx == _particleCount, "Abnormal error in particle quad");
|
||||
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
//
|
||||
// Using VBO and VAO
|
||||
//
|
||||
|
@ -371,7 +375,8 @@ void ParticleSystemQuad::draw()
|
|||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
//
|
||||
// Using VBO without VAO
|
||||
//
|
||||
|
@ -453,10 +458,12 @@ void ParticleSystemQuad::setTotalParticles(int tp)
|
|||
}
|
||||
|
||||
initIndices();
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
setupVBOandVAO();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
setupVBO();
|
||||
}
|
||||
}
|
||||
|
@ -527,10 +534,12 @@ void ParticleSystemQuad::setupVBO()
|
|||
|
||||
void ParticleSystemQuad::listenBackToForeground(Object *obj)
|
||||
{
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
setupVBOandVAO();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
setupVBO();
|
||||
}
|
||||
}
|
||||
|
@ -575,10 +584,12 @@ void ParticleSystemQuad::setBatchNode(ParticleBatchNode * batchNode)
|
|||
allocMemory();
|
||||
initIndices();
|
||||
setTexture(oldBatch->getTexture());
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
setupVBOandVAO();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
setupVBO();
|
||||
}
|
||||
}
|
||||
|
@ -595,7 +606,8 @@ void ParticleSystemQuad::setBatchNode(ParticleBatchNode * batchNode)
|
|||
|
||||
glDeleteBuffers(2, &_buffersVBO[0]);
|
||||
memset(_buffersVBO, 0, sizeof(_buffersVBO));
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
glDeleteVertexArrays(1, &_VAOname);
|
||||
GL::bindVAO(0);
|
||||
_VAOname = 0;
|
||||
|
|
|
@ -62,7 +62,8 @@ TextureAtlas::~TextureAtlas()
|
|||
|
||||
glDeleteBuffers(2, _buffersVBO);
|
||||
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
glDeleteVertexArrays(1, &_VAOname);
|
||||
GL::bindVAO(0);
|
||||
}
|
||||
|
@ -192,10 +193,12 @@ bool TextureAtlas::initWithTexture(Texture2D *texture, long capacity)
|
|||
|
||||
this->setupIndices();
|
||||
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
setupVBOandVAO();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
setupVBO();
|
||||
}
|
||||
|
||||
|
@ -206,10 +209,12 @@ bool TextureAtlas::initWithTexture(Texture2D *texture, long capacity)
|
|||
|
||||
void TextureAtlas::listenBackToForeground(Object *obj)
|
||||
{
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
setupVBOandVAO();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
setupVBO();
|
||||
}
|
||||
|
||||
|
@ -605,7 +610,8 @@ void TextureAtlas::drawNumberOfQuads(long numberOfQuads, long start)
|
|||
|
||||
GL::bindTexture2D(_texture->getName());
|
||||
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
//
|
||||
// Using VBO and VAO
|
||||
//
|
||||
|
@ -649,7 +655,8 @@ void TextureAtlas::drawNumberOfQuads(long numberOfQuads, long start)
|
|||
|
||||
// glBindVertexArray(0);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
//
|
||||
// Using VBO without VAO
|
||||
//
|
||||
|
|
|
@ -184,7 +184,8 @@ void deleteTextureN(GLuint textureUnit, GLuint textureId)
|
|||
|
||||
void bindVAO(GLuint vaoId)
|
||||
{
|
||||
if (Configuration::getInstance()->supportsShareableVAO()) {
|
||||
if (Configuration::getInstance()->supportsShareableVAO())
|
||||
{
|
||||
|
||||
#if CC_ENABLE_GL_STATE_CACHE
|
||||
if (s_uVAO != vaoId)
|
||||
|
|
Loading…
Reference in New Issue