Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

Commit

Permalink
Added gh-pages script (#28)
Browse files Browse the repository at this point in the history
* Added gh-pages script

* Added screenshots and links

* Move examples, setup domain
  • Loading branch information
w0rm committed Jul 3, 2016
1 parent 45badb1 commit 248941b
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
elm-stuff
index.html
.DS_Store
gh-pages
15 changes: 7 additions & 8 deletions README.md
Expand Up @@ -5,15 +5,14 @@ for rendering with WebGL. This is useful for both 2D and 3D
rendering because it lets you take advantage of hardware acceleration with the
GPU, meaning you can render things more quickly.

Here are some examples so you can get a feel for the API, but make sure you
[Here are some examples](https://github.com/elm-community/elm-webgl/tree/master/examples) so you can get a feel for the API, but make sure you
read on to learn how WebGL and the GPU really work!

[![Triangle](http://elm-lang.org/screenshot/WebGL/Triangle.jpg)](http://elm-lang.org/examples/triangle)
[![Cube](http://elm-lang.org/screenshot/WebGL/Cube.jpg)](http://elm-lang.org/examples/cube)
[![Crate](http://elm-lang.org/screenshot/WebGL/Crate.jpg)](http://elm-lang.org/examples/crate)
[![Thwomp](http://elm-lang.org/screenshot/WebGL/Thwomp.jpg)](http://elm-lang.org/examples/thwomp)
[![FirstPerson](http://elm-lang.org/screenshot/WebGL/FirstPerson.jpg)](http://elm-lang.org/examples/first-person)

[![Triangle](http://webgl.elm-community.org/examples/screenshots/triangle.jpg)](http://webgl.elm-community.org/examples/triangle.html)
[![Cube](http://webgl.elm-community.org/examples/screenshots/cube.jpg)](http://webgl.elm-community.org/examples/cube.html)
[![Crate](http://webgl.elm-community.org/examples/screenshots/crate.jpg)](http://webgl.elm-community.org/examples/crate.html)
[![Thwomp](http://webgl.elm-community.org/examples/screenshots/thwomp.jpg)](http://webgl.elm-community.org/examples/thwomp.html)
[![FirstPerson](http://webgl.elm-community.org/examples/screenshots/first-person.jpg)](http://webgl.elm-community.org/examples/first-person.html)

## Understanding WebGL

Expand Down Expand Up @@ -60,7 +59,7 @@ be and all of the meshes loaded onto the GPU will be transformed accordingly.
The following diagram illustrates the entire pipeline. Keep reading past the
diagram, all the terms will be explained!

![WebGL Pipeline](https://raw.githubusercontent.com/johnpmayer/elm-webgl/master/pipeline.png)
![WebGL Pipeline](https://raw.githubusercontent.com/elm-community/elm-webgl/master/pipeline.png)

We start with a mesh. It's a bunch of raw data points that we want to render on
screen. From there, the data flows through two types of shaders:
Expand Down
2 changes: 1 addition & 1 deletion examples/crate.elm
Expand Up @@ -36,7 +36,7 @@ update action model =
init : (Model, Cmd Action)
init =
( {texture = Nothing, theta = 0}
, loadTexture "/texture/woodCrate.jpg"
, loadTexture "texture/woodCrate.jpg"
|> Task.perform TextureError TextureLoaded
)

Expand Down
2 changes: 1 addition & 1 deletion examples/first-person.elm
Expand Up @@ -90,7 +90,7 @@ init =
, size = Window.Size 0 0
}
, Cmd.batch
[ loadTexture "/texture/woodCrate.jpg"
[ loadTexture "texture/woodCrate.jpg"
|> Task.perform TextureError TextureLoaded
, Window.size |> Task.perform (always Resize (0, 0)) Resize
]
Expand Down
Binary file added examples/screenshots/crate.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/screenshots/cube.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/screenshots/first-person.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/screenshots/thwomp.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/screenshots/triangle.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/thwomp.elm
Expand Up @@ -73,8 +73,8 @@ main =

fetchTextures : Task Error (Maybe Texture, Maybe Texture)
fetchTextures =
loadTexture "/texture/thwomp_face.jpg" `Task.andThen` \faceTexture ->
loadTexture "/texture/thwomp_side.jpg" `Task.andThen` \sideTexture ->
loadTexture "texture/thwomp_face.jpg" `Task.andThen` \faceTexture ->
loadTexture "texture/thwomp_side.jpg" `Task.andThen` \sideTexture ->
Task.succeed (Just faceTexture, Just sideTexture)


Expand Down
26 changes: 26 additions & 0 deletions gh-pages.sh
@@ -0,0 +1,26 @@
#!/bin/bash
set -e

rm -rf gh-pages || exit 0;

mkdir -p gh-pages/examples

# compile JS using Elm
cd examples
for i in crate cube first-person thwomp triangle; do
elm make $i.elm --yes --output ../gh-pages/examples/$i.html
done

# copy the textures
cp -R texture ../gh-pages/examples
cp -R screenshots ../gh-pages/examples

# configure domain
cd ../gh-pages
echo "webgl.elm-community.org" >> CNAME

# init branch and commit
git init
git add .
git commit -m "Deploying to GH Pages"
git push --force "git@github.com:elm-community/elm-webgl.git" master:gh-pages

0 comments on commit 248941b

Please sign in to comment.