I discovered VBO's recently and changed my code to use them instead of immediate mode. Now I'm rendering 25000 squares and it's really slowing down my FPS. If I drew all the squares VBO's to an FBO, then bound it to a single VBO, would it increases performance? The 25000 squares is more of a stress test, im trying to optimize my rendering code for snow. Edit : Each snow particle draws one of three static VBO's, this helped performance.
\$\begingroup\$
\$\endgroup\$
2
-
3\$\begingroup\$ You can't bind a VBO to an FBO. For snow, use instancing. \$\endgroup\$– BWGFeb 18, 2015 at 14:12
-
1\$\begingroup\$ compare with how many square you could have drawn without VBOs \$\endgroup\$– ratchet freakFeb 18, 2015 at 14:17
Add a comment
|
1 Answer
\$\begingroup\$
\$\endgroup\$
You should have only 1 VBO that contains all of your squares and render it in one single draw call.
Use a texture atlas to combine all your snowflake textures.
Also, look into using a geometry shader to do point sprite expansion, this can reduce your VBO to a single vec4 encoding it as (position.x, position.y, position.z, angle). Have the geometry shader generate the UVs and vertex coordinates from that point+angle.