1
Fork 0

odin(sdl-opengl-rendering): tinker with instancing

This commit is contained in:
prescientmoon 2025-04-01 23:59:12 +02:00
parent f98d2a6baa
commit b3aad17877
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
4 changed files with 258 additions and 67 deletions
odin/sdl-opengl-rendering/src

View file

@ -1,10 +1,13 @@
#version 330
in vec2 aPos;
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec4 instanceFill;
layout (location = 2) in mat3 instanceMatrix;
out vec4 vertexColor;
void main() {
gl_Position = vec4(aPos.x, aPos.y, 0, 1);
vertexColor = vec4((aPos.x + 1) / 2, (aPos.y + 1) / 2, 1, 1);
vec3 pos = instanceMatrix * vec3(aPos.xy, 1);
gl_Position = vec4(pos.xyz, 1);
vertexColor = instanceFill;
}