Рет қаралды 8,468
In this video we take a break from 3D and explore 2D rendering using a sprite batching technique in OpenGL. This is also a great opportunity to get introduced to Uniform Buffer Objects which is a more efficient way of loading uniforms than the method that we've been using so far, especially when you have many of them. UBOs can be used for 3D as well so even if you don't plan on doing 2D rendering you should definitely learn about them.
The sprites that I used are from www.gameart2d.com
Free texture packing tool: www.codeandweb.com/tp-online
Timecodes
0:00 Intro
0:26 Sprite Batching
1:54 Calculating sprite size in texture space
2:34 Screen space to NDC
2:47 Sprite batching solution
4:09 The vertex shader
4:54 The fragment shader
5:52 Supporting multiple sprite sheets
6:03 The QuadArray class
6:37 The SpriteBatch class
8:22 Simple animation example
8:35 Efficiency of uniform variables
9:08 Uniform Buffer Objects
13:40 Conclusion
Make sure to watch all the previous tutorials in the "OpenGL For Beginners" playlist at • OpenGL for Beginners
Please visit ogldev.org to see more of my tutorials on modern OpenGL.
Link to source: github.com/emeiri/ogldev/blob...
OpenGL 4.6 specification: www.khronos.org/registry/Open...
Feel free to comment below.
Email: ogldev1@gmail.com
Github: github.com/emeiri/ogldev.git
Twitter: @ogldev
One time donations (Paypal): ogldev.org/donate.html
Patreon: / ogldev
Enjoy,
Etay Meiri
#opengl #ogldev #opengtutorials