Skip to content

graphics/tinygl: add TinyGL software OpenGL library - #3801

Merged
xiaoxiang781216 merged 2 commits into
apache:masterfrom
acassis:tinygl_nuttx
Sep 28, 2026
Merged

xiaoxiang781216 merged 2 commits into
apache:masterfrom
acassis:tinygl_nuttx

Conversation

@acassis

@acassis acassis commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Add TinyGL (https://github.com/C-Chads/tinygl), a small software-only implementation of a subset of OpenGL 1.1 written in portable C99, by Fabrice Bellard, Gek and C-Chads, under a zlib-style license.

Like graphics/lvgl, the sources are not kept in the repository: the build downloads a pinned git revision from GitHub
(CONFIG_TINYGL_VERSION) and applies the NuttX patches that live next to the Makefile:

0001 zfeatures: allow overriding the feature switches at build time
0002 Fix -Wstrict-prototypes warnings
0003 zbuffer: do not over-read the source in ZB_copyFrameBuffer()
0004 zbuffer.h: make the default allocator wrappers static inline

The TinyGL compile time features (pixel depth, GL_SELECT, GL_POLYGON, blending, texture size, ...) are exposed as CONFIG_TINYGL_* Kconfig options. They change public structures, so Make.defs / CMakeLists.txt export them to every application that includes <GL/gl.h> or <zbuffer.h>.

Both the make and the CMake builds are supported. An unpack stamp file makes sure an object directory created inside the source tree is never mistaken for downloaded sources.

Impact

Users will be able to use OpenGL on NuttX

Testing

TinyGL Gears

image

Comment thread graphics/tinygl/0003-zbuffer-do-not-over-read-the-source-in-ZB_copyFrameB.patch Outdated
Comment thread examples/tinygl/tinygl_main.c
Add TinyGL (https://github.com/C-Chads/tinygl), a small software-only
implementation of a subset of OpenGL 1.1 written in portable C99, by
Fabrice Bellard, Gek and C-Chads, under a zlib-style license.

Like graphics/lvgl, the sources are not kept in the repository: the
build downloads a pinned git revision from GitHub
(CONFIG_TINYGL_VERSION) and applies the NuttX patches that live next to
the Makefile:

  0001 zfeatures: allow overriding the feature switches at build time
  0002 Fix -Wstrict-prototypes warnings
  0003 zbuffer: do not over-read the source in ZB_copyFrameBuffer()
  0004 zbuffer.h: make the default allocator wrappers static inline

The TinyGL compile time features (pixel depth, GL_SELECT, GL_POLYGON,
blending, texture size, ...) are exposed as CONFIG_TINYGL_* Kconfig
options.  They change public structures, so Make.defs / CMakeLists.txt
export them to every application that includes <GL/gl.h> or
<zbuffer.h>.

Both the make and the CMake builds are supported.  An unpack stamp file
makes sure an object directory created inside the source tree is never
mistaken for downloaded sources.

Assisted-by: Claude Opus 5.5 (1M context)
Signed-off-by: Alan Carvalho de Assis <acassis@gmail.com>
Render Brian Paul's classic OpenGL "gears" demo with TinyGL on a NuttX
framebuffer device.  TinyGL draws each frame into its own ZBuffer, which
is then copied to the mmap()ed framebuffer (plus FBIO_UPDATE when
CONFIG_FB_UPDATE is enabled), so partially drawn frames are never shown.
The frame rate is printed every five seconds.

Usage: tinygl [frames] [fbdev]

Tested on sim:tinygl (640x480, 32 bpp): about 1400 FPS with
CONFIG_DEBUG_FULLOPT on an x86_64 host, with both make and CMake.

Assisted-By: Claude Opus 5.5 (1M context)
Signed-off-by: Alan Carvalho de Assis <acassis@gmail.com>
@acassis

acassis commented Sep 27, 2026

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 PTAL

Please ignore the CI Check typo "lightening" it is on original tinygl code, not someone from this PR

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool big thank you @acassis !! :-)

@xiaoxiang781216
xiaoxiang781216 merged commit b66303e into apache:master Sep 28, 2026
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants