Show a GPU-compressed KTX2 image
Updated
A framed picture on an easel shows a .ktx2 texture, which stays compressed in GPU memory. The script logs its pixel size when it is ready.
The picture on the easel is a KTX2 texture; the log gives its size. Drag to orbit the camera, scroll to zoom.
Show a GPU-compressed KTX2 image
#pragma lifecycle(startup)
function startup() { const picture = findEntity('Picture').getComponent(KTX2Component); log('Loading', picture.props.src); on('picture', ({ eventType, data }) => { if (eventType === EventType.KTX2.Ready) log(`KTX2 texture ready: ${data.width} x ${data.height} px, kept compressed on the GPU`); if (eventType === EventType.KTX2.Error) log('Could not load the texture:', data.message); });}Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
Ktx2Texture.xrproj