Giter Site home page Giter Site logo

robertomalatesta / helloworld-sdl2-opengl-emscripten Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redblobgames/helloworld-sdl2-opengl-emscripten

0.0 2.0 0.0 285 KB

Basic program that uses SDL2+OpenGL, compiling both locally and via emscripten

License: Apache License 2.0

CMake 1.48% Makefile 4.12% C++ 90.64% HTML 3.76%

helloworld-sdl2-opengl-emscripten's Introduction

http://unmaintained.tech/badge.svg

I wanted a bare-bones program for SDL2 + OpenGL 2D rendering that also compiled to JS+WebGL with Emscripten+Wasm. There are some SDL2 + OpenGL tutorials out there but most of them don’t target the WebGL subset of OpenGL. I can’t use the fixed function pipeline, so older OpenGL code won’t work, and I can’t use newer things like vertex array objects, instancing, or geometry shaders, so newer OpenGL code often won’t work.

Installation

The Makefile only works on Mac OS X, but the code should work on Linux and Windows and other SDL+OpenGL platforms (I haven’t tried though). On Mac I installed these libraries for compilation:

brew install SDL2 SDL2_image emscripten
git submodule init
git submodule update

To run the native code:

make && bin/main

To run the emscripten code:

make www

and then tell the webserver to serve the files from www/.

The Emscripten-ed wasm output is here.

I’ve also written a partial CMakeLists.txt file but am not using it yet.

To disable WebAssembly, take out the -s WASM=1 flag in the Makefile.

The font included in this project is Droid Sans, under the Apache License v2. The ImGui library includes the Proggy font.

helloworld-sdl2-opengl-emscripten's People

Contributors

redblobgames avatar amitp avatar timotei avatar

Watchers

Roberto Malatesta avatar  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.