{"action":"created","issue":{"url":"https://api.github.com/repos/bkaradzic/bgfx/issues/386","labels_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/386/labels{/name}","comments_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/386/comments","events_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/386/events","html_url":"https://github.com/bkaradzic/bgfx/issues/386","id":75767399,"number":386,"title":"Best practices for 2D sprite rendering","user":{"login":"RichardGale","id":3767708,"avatar_url":"https://avatars.githubusercontent.com/u/3767708?v=3","gravatar_id":"","url":"https://api.github.com/users/RichardGale","html_url":"https://github.com/RichardGale","followers_url":"https://api.github.com/users/RichardGale/followers","following_url":"https://api.github.com/users/RichardGale/following{/other_user}","gists_url":"https://api.github.com/users/RichardGale/gists{/gist_id}","starred_url":"https://api.github.com/users/RichardGale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichardGale/subscriptions","organizations_url":"https://api.github.com/users/RichardGale/orgs","repos_url":"https://api.github.com/users/RichardGale/repos","events_url":"https://api.github.com/users/RichardGale/events{/privacy}","received_events_url":"https://api.github.com/users/RichardGale/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-12T22:47:28Z","updated_at":"2015-05-13T03:05:10Z","closed_at":null,"body":"I'm looking to switch from libSDL2 to bgfx for my 2D sprite game. Before switching curious if there are any best practices for implementation with bgfx and/or examples of 2D sprite rendering. The requirements are relatively low, <10,000 moving, rotating, tinted sprites, sorted on layer coming from sprite sheets.\r\n\r\nThank you,\r\nRichard."},"comment":{"url":"https://api.github.com/repos/bkaradzic/bgfx/issues/comments/101492767","html_url":"https://github.com/bkaradzic/bgfx/issues/386#issuecomment-101492767","issue_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/386","id":101492767,"user":{"login":"bkaradzic","id":814772,"avatar_url":"https://avatars.githubusercontent.com/u/814772?v=3","gravatar_id":"","url":"https://api.github.com/users/bkaradzic","html_url":"https://github.com/bkaradzic","followers_url":"https://api.github.com/users/bkaradzic/followers","following_url":"https://api.github.com/users/bkaradzic/following{/other_user}","gists_url":"https://api.github.com/users/bkaradzic/gists{/gist_id}","starred_url":"https://api.github.com/users/bkaradzic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkaradzic/subscriptions","organizations_url":"https://api.github.com/users/bkaradzic/orgs","repos_url":"https://api.github.com/users/bkaradzic/repos","events_url":"https://api.github.com/users/bkaradzic/events{/privacy}","received_events_url":"https://api.github.com/users/bkaradzic/received_events","type":"User","site_admin":false},"created_at":"2015-05-13T03:05:10Z","updated_at":"2015-05-13T03:05:10Z","body":"There are different ways to implement this, depending on use. Static backgrounds that are made of 2D tiles you could do whole thing inside fragment shader and drawing full screen quad (not sure if it's the best method for all platforms, but it's most elegant one). For dynamic sprites, particles, etc. the best is to use transient buffers. They don't require managing, assumption is that life span is 1 frame, and you just fill them up with sprite/particle data and add to draw call.\r\n\r\n02-metaballs is example how to use transient buffers to create dynamic geometry:\r\nhttps://github.com/bkaradzic/bgfx/blob/master/examples/02-metaballs/metaballs.cpp#L589"}}