Skip to content
modkitv0.2

Example 33 - GPU->CPU texture read-back round trip (mk_texture_read).

← All examples33_readback

Renders a known clear color into an offscreen render target, blits it into a read-back-capable texture, then reads the pixels back to the CPU and verifies them. Demonstrates the async read-back protocol: mk_texture_read() returns the frame number at which the data is valid; after each successful mk_frame_end(), we poll mk_frame_number() until it catches up.

Example 33 - GPU->CPU texture read-back round trip (mk_texture_read).

Runs the WebAssembly build on this page. Click the canvas to give it keyboard focus.

Number
33
Tags
texturerender-targetinput
Source
examples/33_readback/main.c

Build and run

./scripts/build-linux.sh release --target=33_readback --run