Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode
frag.d
frag.o
frag
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "stb"]
path = stb
url = https://github.com/nothings/stb.git
Binary file added Examples/lizard_skin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions Examples/tile/License-BSD.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Copyright � 2013 Jordan Irwin (a.k.a. AntumDeluge)
All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice(s), this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice(s), this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY [LICENSOR] "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
323 changes: 323 additions & 0 deletions Examples/tile/License-CC-BY-3.0.txt

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions Examples/tile/License-MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright � 2013 Jordan Irwin (a.k.a. AntumDeluge)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this work and associated documentation files (the "Work"), to deal
in the Work without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Work, and to permit persons to whom the Work is
furnished to do so, subject to the following conditions:

The above copyright notice(s) and this permission notice shall be included in
all copies or substantial portions of the Work.

THE Work IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE Work OR THE USE OR OTHER DEALINGS IN
THE Work.
15 changes: 15 additions & 0 deletions Examples/tile/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Description:
A tiled-style texture/tile for seamless background usage.

Copyright � 2013 Jordan Irwin (a.k.a. AntumDeluge)

This work can be distributed under the terms and conditions of one of the following included licenses:

� Creative Commons Attribution 3.0 (or later):
See License-CC-BY-3.0.txt

� BSD-style:
See License-BSD.txt

� MIT-style:
See License-MIT.txt
Binary file added Examples/tile/tile_aqua.png
Loading
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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ SOURCES = $(wildcard *.cpp)
OBJECTS = $(SOURCES:.cpp=.o)
DEPENDS = $(SOURCES:.cpp=.d)
## If you're not on MacOS, you'll need to change this line.
LDFLAGS = -L/opt/local/lib -lglew -lglfw -framework OpengL
LDFLAGS = -L/opt/homebrew/lib -lglew -lglfw -framework OpengL
## You might need to change /opt/local/include so that you can
## find GLFW, GLM, etc.
CPPFLAGS = -I/opt/local/include -std=c++11
CPPFLAGS = -I/opt/local/include -I/opt/homebrew/Cellar/glew/2.2.0_1/include -I/opt/homebrew/Cellar/glfw/3.4/include -I/opt/homebrew/Cellar/glm/1.0.1/include -std=c++11
CXXFLAGS = $(CPPFLAGS) -W -Wall -O3 -g
CXX = g++

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@ A simple 2D fragment shader viewer, inspired by Shadertoy (www.shadertoy.com)

This tool was designed to support one small feature over and above Shadertoy: the ability to navigate a virtual 2D plane interactively, using the mouse. (This is possible with Shadertoy as well, but it's inconvenient.) I used it to explore a number of algorithms for drawing repeating patterns implicitly (i.e., draw a tiling by sampling positions in the plane rather than pushing polygons through the graphics pipeline).

# Building (Mac)
* brew install glm --build-from-source
* brew install glew --build-from-source
* git submodule update
* make

# Launching:

Straightforward, just run a fragment shader:
```
```sh
./frag something.frag
```
Run a fragment shader that reads from a texture:
```
./frag -tex some_texture.png something_with_texture.frag
```sh
./frag -tex Examples/tile/tile_aqua.png Examples/lizards1.frag
```
Run a fragment shader that writes in multiple passes to an FBO and then reads from the FBO to write to the screen.
```
Expand Down
2 changes: 1 addition & 1 deletion frag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#include <glm/glm.hpp>

#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#include "stb/stb_image.h"

using namespace glm;
using namespace std;
Expand Down
1 change: 1 addition & 0 deletions stb
Submodule stb added at f75e8d