For a while now I have been working on my own framework to replace my (unneccesary) reliance on Game Maker: Studio
Today I decided to see how me engine benchmarks against GM:S. Might code is reasonably tight (so I thought) but GM's renderer still runs rings around mine. GM:S also uses DirectX 9c too.
These are the results;
# Sprites (256x256) Mine GM:S 1.3
1 1570 ~1350
10 706 ~1350
100 106 ~1100
500 25 ~620
1000 13 ~450
My renderer is faster when displaying one sprite, but then drops off quite rapidly.I am using the ID3DXSprite interface to create and render the sprites. This is my entire render code. The sprites are all stored in a vector and use the same image (for testing purposes).
void Renderer::renderSpriteQueue()
{
SpriteSortByDepth();
pSprite->Begin(D3DXSPRITE_ALPHABLEND);
std::vector<Sprite>::iterator it;
for(it=vSprite.begin();it<vSprite.end();it++)
{
RECT rectSpriteTextureArea;
D3DXVECTOR3 v3Center;
D3DXVECTOR3 v3Position;
rectSpriteTextureArea.top=0;
rectSpriteTextureArea.bottom=it->nSizeY;;
rectSpriteTextureArea.left=0;
rectSpriteTextureArea.right=it->nSizeX;
v3Center=D3DXVECTOR3(0,0,0);
v3Position=D3DXVECTOR3(it->fPosX,it->fPosY,0);
if(FAILED(pSprite->Draw(pTexture,&rectSpriteTextureArea,&v3Center,&v3Position,0xFFFFFFFF)))
MessageBox(NULL,"Error","Error",NULL);
}
pSprite->Flush();
pSprite->End();
}
Am I doing something in-efficiently here? Would it be faster to just use a textured quad instead?Any advice would be awesome