Merge pull request #5062 from darkdukey/fixVBOFull

Fix vbo full
This commit is contained in:
Ricardo Quesada 2014-01-14 17:13:04 -08:00
commit 8554eaa46c
3 changed files with 45 additions and 1 deletions

View File

@ -251,7 +251,9 @@ void Renderer::render()
CCASSERT(cmdQuadCount < VBO_SIZE, "VBO is not big enough for quad data, please break the quad data down or use customized render command");
//Draw batched quads if VBO is full
_lastCommand --;
drawBatchedQuads();
_lastCommand ++;
}
memcpy(_quads + _numQuads, cmd->getQuad(), sizeof(V3F_C4B_T2F_Quad) * cmdQuadCount);
@ -414,7 +416,7 @@ void Renderer::drawBatchedQuads()
}
_firstCommand = _lastCommand;
_firstCommand = _lastCommand + 1;
_numQuads = 0;
}

View File

@ -38,6 +38,7 @@ static std::function<Layer*()> createFunctions[] =
CL(NewClippingNodeTest),
CL(NewDrawNodeTest),
CL(NewCullingTest),
CL(VBOFullTest),
};
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
@ -485,3 +486,32 @@ std::string NewCullingTest::subtitle() const
return "Culling";
}
VBOFullTest::VBOFullTest()
{
Size s = Director::getInstance()->getWinSize();
Node* parent = Node::create();
parent->setPosition(s.width/2, s.height/2);
addChild(parent);
for (int i=0; i<Renderer::VBO_SIZE * 2; ++i)
{
Sprite* sprite = Sprite::create("Images/grossini_dance_01.png");
sprite->setPosition(Point(0,0));
parent->addChild(sprite);
}
}
VBOFullTest::~VBOFullTest()
{
}
std::string VBOFullTest::title() const
{
return "New Renderer";
}
std::string VBOFullTest::subtitle() const
{
return "VBO full Test, everthing should render normally";
}

View File

@ -118,4 +118,16 @@ protected:
virtual ~NewCullingTest();
};
class VBOFullTest : public MultiSceneTest
{
public:
CREATE_FUNC(VBOFullTest);
virtual std::string title() const override;
virtual std::string subtitle() const override;
protected:
VBOFullTest();
virtual ~VBOFullTest();
};
#endif //__NewRendererTest_H_