mirror of https://github.com/axmolengine/axmol.git
Fix sorting bug
This commit is contained in:
parent
e4ffd250cb
commit
51fb1edc0c
|
@ -39,17 +39,22 @@ void Renderer::setOpenGLView(EGLView *newOpenGLView)
|
|||
|
||||
void Renderer::addRenderCommand(RenderCommand *command)
|
||||
{
|
||||
command.generateID();
|
||||
command->generateID();
|
||||
_renderQueue.push_back(command);
|
||||
}
|
||||
|
||||
bool compareRenderCommand(RenderCommand* a, RenderCommand* b)
|
||||
{
|
||||
return a->getID() < b->getID();
|
||||
}
|
||||
|
||||
void Renderer::render()
|
||||
{
|
||||
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
//Process render commands
|
||||
//1. Sort render commands based on ID
|
||||
// stable_sort(_renderQueue.begin(), _renderQueue.end());
|
||||
stable_sort(_renderQueue.begin(), _renderQueue.end(), compareRenderCommand);
|
||||
// sort(_renderQueue.begin(), _renderQueue.end());
|
||||
|
||||
//2. Process commands
|
||||
|
|
Loading…
Reference in New Issue