Modern OpenGL Core
Source: examples/demo-libretro
The demo example is a hardware-rendered core with input and audio feedback. It shows:
- content/no-game handling,
- modern preferred OpenGL context negotiation,
- typed GL loading with
Gl::init, - shader/program/buffer/vertex-array setup,
- typed joypad polling,
- generated audio mixed into a silent frame batch,
- hardware frame submission with
video_refresh_hw_with_audio, - fallback duplicate-frame submission when hardware state is unavailable.
The triangle changes color based on whether content was supplied and moves with joypad input. This makes it a useful smoke test for content loading, input, OpenGL, and audio pacing in one core.
Lifecycle map:
load_gamelogs optional content, setsPixelFormat::Xrgb8888, and requestsopengl_modern_preferred_hw_render_candidates().runpolls joypad input, mixes a short sound effect into a silent audio batch, renders intoruntime.current_framebuffer(), and submitsvideo_refresh_hw_with_audio.hw_context_resetloadsGl, picks shader sources for the negotiated GL family, and creates the program, buffer, and optional vertex array.hw_context_destroydeletes GL-owned objects and clears cached handles.
Fallbacks in this demo keep audio moving with duplicate frames. For visible OpenGL diagnostics, use the compatibility example.
Tutorials: