Code Monkey home page Code Monkey logo

zero-graphics's Introduction

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.

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 stb_image
  • 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 -Dbackend=desktop_sdl2 run

A window should open with the application in fullscreen.

Web/Wasm version

Includes a teeny tiny web server for debugging.

zig build -Dbackend=wasm install run

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.

zig build -Dbackend=android run

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

zero-graphics's People

Contributors

ikskuh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.