2 triangles with different uniforms

This commit is contained in:
nothke 2024-06-11 23:42:03 +02:00
parent 114cc1b057
commit c4c104538b

View File

@ -69,13 +69,15 @@ export fn frame() void {
col.g = @abs(@sin(timef())); col.g = @abs(@sin(timef()));
col.r = @abs(@cos(timef())); col.r = @abs(@cos(timef()));
state.vsParams.offset[0] = col.r;
sg.beginPass(.{ .action = pass_action, .swapchain = sokol.glue.swapchain() }); sg.beginPass(.{ .action = pass_action, .swapchain = sokol.glue.swapchain() });
sg.applyPipeline(state.pip); sg.applyPipeline(state.pip);
state.vsParams.offset[0] = col.r;
sg.applyUniforms(.FS, shader.SLOT_fs_params, sg.asRange(&state.vsParams)); sg.applyUniforms(.FS, shader.SLOT_fs_params, sg.asRange(&state.vsParams));
sg.applyBindings(state.bind); sg.applyBindings(state.bind);
sg.draw(0, 3, 1); sg.draw(0, 3, 1);
state.vsParams.offset[0] = col.g;
sg.applyUniforms(.FS, shader.SLOT_fs_params, sg.asRange(&state.vsParams));
sg.applyBindings(state.bind2); sg.applyBindings(state.bind2);
sg.draw(0, 3, 1); sg.draw(0, 3, 1);
sg.endPass(); sg.endPass();