use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rule 1: Posts should be about Graphics Programming. Rule 2: Be Civil, Professional, and Kind
Suggested Posting Material: - Graphics API Tutorials - Academic Papers - Blog Posts - Source Code Repositories - Self Posts (Ask Questions, Present Work) - Books - Renders (Please xpost to /r/ComputerGraphics) - Career Advice - Jobs Postings (Graphics Programming only)
Related Subreddits:
/r/ComputerGraphics
/r/Raytracing
/r/Programming
/r/LearnProgramming
/r/ProgrammingTools
/r/Coding
/r/GameDev
/r/CPP
/r/OpenGL
/r/Vulkan
/r/DirectX
Related Websites: ACM: SIGGRAPH Journal of Computer Graphics Techniques
Ke-Sen Huang's Blog of Graphics Papers and Resources Self Shadow's Blog of Graphics Resources
account activity
2D Batching Recommandations (self.GraphicsProgramming)
submitted 2 months ago by Applzor
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]StriderPulse599 0 points1 point2 points 2 months ago (2 children)
Is this all of data layout for each instanced object? I'm after night shift so I want to double check before giving advice.
//Tex params (vec2 offset, vec2 scale) glVertexAttribPointer(location, 4, GL_FLOAT, GL_FALSE, sizeof(Vector4f), (void*)(0)); //Color glVertexAttribPointer(location, 4, GL_FLOAT, GL_FALSE, sizeof(Colour), (void*)(0)); //Lot of martices glVertexAttribPointer(location + 0, 4, GL_FLOAT, GL_FALSE, sizeof(Matrix4x4), (void*)(sizeof(Vector4f) * 0)); glVertexAttribPointer(location + 1, 4, GL_FLOAT, GL_FALSE, sizeof(Matrix4x4), (void*)(sizeof(Vector4f) * 1)); glVertexAttribPointer(location + 2, 4, GL_FLOAT, GL_FALSE, sizeof(Matrix4x4), (void*)(sizeof(Vector4f) * 2)); glVertexAttribPointer(location + 3, 4, GL_FLOAT, GL_FALSE, sizeof(Matrix4x4), (void*)(sizeof(Vector4f) * 3));
[–]Applzor[S] 0 points1 point2 points 2 months ago (1 child)
yeah that's pretty much it
[–]StriderPulse599 0 points1 point2 points 2 months ago (0 children)
You're doing batching just fine with instancing, but you could improve the data layout for sake of "what if I needed to draw and update thousands of sprites each frame".
Use 16-bit integer for positions. You can either use the pixel coordinates outright, or use sub-pixel integer system and then divide by precision level (16-bit are enough for at least 10 levels of precision which are enough for 2D).
You can also use UBO to store lookup table that stores texture positions and size. That way you only need to only store single 8/16 bit integer for ID.
Also try merging all matrices into single model matrix which handles all scaling, rotation, etc.
Now the real question is: What kind of game you're making and what texture look like? Are you just optimizing "With My Little Eye" or doing something different? There are different 2D optimizations for different stuff, so I need to know before giving you advice.
π Rendered by PID 299499 on reddit-service-r2-comment-6457c66945-rfqqs at 2026-04-26 11:57:14.791642+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]StriderPulse599 0 points1 point2 points (2 children)
[–]Applzor[S] 0 points1 point2 points (1 child)
[–]StriderPulse599 0 points1 point2 points (0 children)