7/31/2023 0 Comments Opengl es 2.0 point sprite example![]() Is binding a shader or binding a texture more expensive? So should I group the glDrawArrays-calls by shader or texture? Is it even a good idea to perform the rotation in the shader, or should I calculate that part when calculating the position of the vertices on the CPU side? ![]() Which totals to 36 bytes per vertex or 144 bytes per sprite.Ĭan I do better than 36 bytes? I feel like having position, angle and origin point is a bit redundant. In vec2 rotOrigin // point to rotate around Each vertex having the following attributes: in vec3 position // 3 as I use the Z-buffer So when I only have one shader and all the spritesheets fit on one texture, there is only one glDrawArrays call.Ĭurrently I store 4 Vertices per sprite. I have a VBO for each unique texture-shader pair, which gets drawn by a single glDrawArrays call. My current implementation packs different sprite-sheets into as few as possible large textures. Those have a position, a blend color, can be rotated and scaled, the point of rotation should be customizable. The graphics will consist mainly of 2D sprites, (possibly thousands of them). ![]() ![]() I target OpenGL 3.0+, so far all of my code is 3.0 compatible, but this is not a must, I'd be ready to switch to a higher version, just want to keep it as low as possible. I'm in the process of writing a 2D game using OpenGL. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |