Original Post
Hi there,
I am writing a 2D engine, and I thought that I had got the right idea to use nothing but quads to draw sprites on.
The thing is that I am experiencing two behaviors that got me decided to post this message on gamedev :
- First, I can see some flickering, generally located on the last sprite drawn. I must say that I am using the OpenGL ES 2.0 reduced set, so all the drawings are made using glDrawElements() on a single quad. I am animating the sprite by changing the texture's coordinate in the vertex shader (I am using an atlas to store all the sprites' poses and I simply loop through them). Oddly enough, when I animate the sprites, I can see some of them flickering --usually the last drawn but not always, whereas everything is drawn smoothly when I do not animate. The only difference between *animating* and not animating is dynamically changing the texture's coordinate in the vertex shader...
- Second, I was surprised to see that my frame rate goes down to 30FPS when I display 3,000 sprites. I assume that it is due to the number of call to glDrawElements(), because I can draw way more than 3,000 x 2 triangles in my 3D engine before seeing the FPS go down. But does it make sense that only 3,000 calls to glDrawElements() degrade so much the performances ?
Could someone please tell me whether what I am doing is the right thing to do or not ? Does someone know where the flickering could be coming from ?
I just noticed that if I turn GL_DEPTH_TEST on, the flickering tends to disappear !?!!
Thank you in advance !
Cheers,
stratboy61
I am writing a 2D engine, and I thought that I had got the right idea to use nothing but quads to draw sprites on.
The thing is that I am experiencing two behaviors that got me decided to post this message on gamedev :
- First, I can see some flickering, generally located on the last sprite drawn. I must say that I am using the OpenGL ES 2.0 reduced set, so all the drawings are made using glDrawElements() on a single quad. I am animating the sprite by changing the texture's coordinate in the vertex shader (I am using an atlas to store all the sprites' poses and I simply loop through them). Oddly enough, when I animate the sprites, I can see some of them flickering --usually the last drawn but not always, whereas everything is drawn smoothly when I do not animate. The only difference between *animating* and not animating is dynamically changing the texture's coordinate in the vertex shader...
- Second, I was surprised to see that my frame rate goes down to 30FPS when I display 3,000 sprites. I assume that it is due to the number of call to glDrawElements(), because I can draw way more than 3,000 x 2 triangles in my 3D engine before seeing the FPS go down. But does it make sense that only 3,000 calls to glDrawElements() degrade so much the performances ?
Could someone please tell me whether what I am doing is the right thing to do or not ? Does someone know where the flickering could be coming from ?
I just noticed that if I turn GL_DEPTH_TEST on, the flickering tends to disappear !?!!
Thank you in advance !
Cheers,
stratboy61