Skip to content

Application framework based on OpenGL ES 2.0. Runs on desktop machines, Android phones and the web

License

Notifications You must be signed in to change notification settings

ikskuh/zero-graphics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zero Graphics

A very minimal OpenGL ES 2.0 library for Zig. Opens you a window and let's you draw things. Comes with a pixel-perfect 2D renderer and maybe some day even with a bit of a 3D api.

Logo

Project status

Very work in progress. Right now it's more a proof of concept than everything else

Preview screenshot in FireFox

Project Goals

Basic Framework

  • Support the following platforms
    • Wasm
    • Linux Desktop
    • Windows Desktop (not tested, but should work via SDL2)
    • Android
  • Create an OpenGL ES 2.0 context
  • Provide input events
    • Single pointer motion (finger or mouse)
    • Single click event (finger, mouse)
    • Text input for keyboard (utf-8 encoded)
  • Provide window events
    • Resize
    • Close
  • Provide access to the underlying backend
  • Allow creation of single-file applications
    • Single executable for easy distribution
    • Embedded resources

2D Rendering library

  • Pixel perfect drawing of
    • Lines
    • Rectangles
    • Images
      • Basic "copy full texture to rectangle"
      • Copy portion of texture ("atlas rendering")
  • TTF font rendering via stb_ttf
  • Image loading via zigimg
  • Stack based/nested scissoring

Features

  • Support for desktop linux
  • Mobile linux (PinePhone) supported as well
  • Browser support via Wasm
  • coming soon: Android support
  • Pixel perfect 2D rendering

Dependencies

Desktop

  • SDL2

Web

Android

  • Android SDK
  • Android NDK
  • Android Build Tools
  • OpenJDK
  • some other tools

Building / Running

Desktop PC

Requires SDL2 to be installed.

zig build run

A window should open with the application in fullscreen.

Web/Wasm version

Includes a teeny tiny web server for debugging.

zig build install run-wasm

Now visit http://127.0.0.1:8000/index.htm to see the demo.

Android

Connect your phone first and install both a JDK as well as the Android SDK with NDK included. The ZeroGraphics build system will tell you if it couldn't auto-detect the SDK paths.

zig build -Denable-android run-app

The app should now be installed and started on your phone.