Search Results

Search found 1 results on 1 pages for 'dekowta'.

Page 1/1 | 1 

  • Sprite batching seems slow

    - by Dekowta
    I have implemented a sprite batching system in OpenGL which will batch sprites based on their texture. How ever when I'm rendering ~5000 sprites all using the same texture i'm getting roughly 30fps. The process is as followed create sprite batch which also create a VBO with a set size and also creates the shaders as well call begin and initialise the render mode (at the moment just setting alpha on) call Draw with a sprite. This checks to see if the texture of the sprite has already been loaded and if so it just creates a pointer to the batch item and adds the new sprite coords. If not then it creates a new batch item and adds the sprite coords to that; it adds the batch item to the main batch. if the max sprite count is reached render will be called call end which calls render to render the left over sprites in the batch. and also resets the buffer offset render loops through each item in the batch and will bind the texture of the batch item, map the data to the buffer and then draw the array. the buffer will then be offset by the amount of sprites drawn. I have a feeling that it could be the method i'm using to store the batched sprites or it could be something else that i'm missing but I still can work it out. the cpp and h files are as followed http://pastebin.com/ZAytErGB http://pastebin.com/iCB608tA On top of this i'm also getting a weird issue where then two sprites are batched on after the other the second sprite will use the same coordinates as the last. And then when one if drawn after it is fine. I can't seem to find what is causing this issue. any help would be appreciated iv been sat trying to work this all out for a while now and cant seems to put my finger on what's causing it all.

    Read the article

1