Bgf 2.14.2 -

BGF is maintained by a small but dedicated team of volunteers. The 2.14.x branch is considered stable for production, while the experimental 2.15 branch (as of early 2025) aims to introduce Vulkan backend support.

You can contribute or seek help via:

Future plans for versions beyond 2.14.2 include:


BGF 2.14.2 has seen active contributions from over 40 developers. The library is used in: bgf 2.14.2

The official documentation for 2.14.2 includes updated tutorials on shader authoring, resource management, and porting from OpenGL immediate mode.

To align with modern graphics practices, BGF 2.14.2 deprecates:

While these changes break a small amount of older code, the migration path is clearly documented. BGF is maintained by a small but dedicated

function read_bgf(file_handle):
    magic = read_bytes(4)
    if magic != "BGF ":
        error("Invalid magic")
major = read_uint8()
minor = read_uint8()
patch = read_uint8()
if (major, minor, patch) != (2, 14, 2):
    warn("Unexpected version")
endian = read_uint8()
set_endianness(endian)
header_size = read_uint32()
total_size = read_uint64()
header_crc = read_uint32()
// Validate header checksum
go_to(0)
header_bytes = read_bytes(header_size)
if crc32(header_bytes) != header_crc:
    error("Header corruption")
section_count = read_uint32()
section_table_ptr = read_uint64()
sections = []
for i in 0 to section_count-1:
    go_to(section_table_ptr + i*32)
    sec = Section()
    sec.type = read_uint32()
    sec.flags = read_uint32()
    sec.data_offset = read_uint64()
    sec.comp_size = read_uint64()
    sec.decomp_size = read_uint64()
    sections.append(sec)
// Process each section
for sec in sections:
    go_to(sec.data_offset)
    raw = read_bytes(sec.comp_size)
if sec.flags & 0x01:   // Zlib compression
        raw = zlib_decompress(raw, sec.decomp_size)
if sec.flags & 0x02:   // XOR obfuscation (key 0xA3)
        for j in 0 to len(raw)-1:
            raw[j] ^= 0xA3
            // Also rotate key: key = ((key << 1) | (key >> 7)) & 0xFF
handle_section(sec.type, raw)


Before diving into the specifics of version 2.14.2, it’s crucial to understand what BGF is. BGF is a lightweight, open-source, cross-platform library designed for rendering 2D graphics using modern GPU APIs. Unlike heavier frameworks (such as Qt’s painting system or Direct2D), BGF abstracts away platform-specific backends, including: Future plans for versions beyond 2

Its primary goals are simplicity, performance, and a tiny footprint. BGF does not manage windows or input; it only renders. This philosophy allows developers to integrate BGF into existing engines or application frameworks without bloat.

bgf_pack --manifest assets.json --output game_data.bgf --version 2.14.2


| Offset (bytes) | Field | Type | Description | |----------------|--------------------|---------------|---------------------------------------| | 0–3 | Magic | char[4] | BGF␣ (0x42 0x47 0x46 0x20) | | 4 | Version major | uint8 | 0x02 | | 5 | Version minor | uint8 | 0x0E (14) | | 6 | Version patch | uint8 | 0x02 | | 7 | Endianness | uint8 | 0x01 = little, 0x02 = big | | 8–11 | Header size | uint32 | Usually 64 bytes | | 12–15 | Total file size | uint64 | Whole file size (supports >4 GB) | | 20–23 | CRC32 of headers | uint32 | Checksum of bytes 0–(header size-1) | | 24–31 | Reserved | uint64 | Zeroed | | 32–35 | Section count | uint32 | Number of data sections | | 36–63 | Section table ptr | uint64 | Absolute offset to section headers |


[uint32 lang_count] then per lang: