Git Product home page Git Product logo

swiftrpi-openglesshadertest's Introduction

SwiftRPi-OpenGLESShaderTest

This is a rudimentary Swift application that uses OpenGL ES to render a custom vertex and fragment shader to a screen-sized quad on a Raspberry Pi.

This requires the open source Swift compiler to be installed on the Raspberry Pi to build. I used the instructions by Andrew Madsen:

http://blog.andrewmadsen.com/post/136137396480/swift-on-raspberry-pi

and the precompiled packages from iAchieved.it:

http://dev.iachieved.it/iachievedit/open-source-swift-on-raspberry-pi-2/

to start from a clean Raspberry-Pi-compatible Ubuntu 14.04 and install the Swift toolchain on that.

After that, you'll need to install the libraspberrypi and libraspberrypi-dev packages to get the proper headers for OpenGL ES and the VideoCore libraries.

At the time I'm writing this, the Swift Package Manager isn't currently operational on Raspberry Pi, so I've created a simple build script to create the project and link in the appropriate modules. To run this, type

./compile.sh 

in the main project directory. This should compile the shadertest application, which you can run.

You can provide the shaders to use for the rendering at the command line, vertex shader first:

./shadertest SimpleVertexShader.vsh Mandelbrot.fsh

If you don't provide any shaders, the application looks for two shader files in the current directory, SimpleVertexShader.vsh and SimpleFragmentShader.fsh. If it finds those, it will load them and render a screen-size quad using them. You can edit these files how you want to produce arbitrary effects. To quit the application, hit Ctrl-C.

I'd like to also recognize SAKrisT's Swift OpenGL example:

https://github.com/sakrist/Swift_OpenGL_Example

, which pointed out something I was doing wrong in my shader loading.

swiftrpi-openglesshadertest's People

Contributors

bradlarson 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.