Skip to content

Instantly share code, notes, and snippets.

View sortofsleepy's full-sized avatar

Joe sortofsleepy

View GitHub Profile
// Create the points of our cube
Vec3f v0(-100,-100,-100);
Vec3f v1( 100,-100,-100);
Vec3f v2( 100, 100,-100);
Vec3f v3(-100, 100,-100);
Vec3f v4(-100,-100, 100);
Vec3f v5( 100,-100, 100);
Vec3f v6( 100, 100, 100);
Vec3f v7(-100, 100, 100);
// Create the colors for each vertex
uniform float amplitude;
attribute float displacement;
varying vec3 vNormal;
varying vec2 vUv;
void main() {
vNormal = normal;
varying vec3 vNormal;
varying vec2 vUv;
uniform vec3 color;
uniform sampler2D texture;
void main() {
vec3 light = vec3( 0.5, 0.2, 1.0 );
light = normalize( light );
//by @kindofsleepy
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
@sortofsleepy
sortofsleepy / gist:6216833
Created August 13, 2013 00:50
In a list of items, this figures out where then end of a row is at any particular given time. 1. box_width = the width of a item in the list 2. work_width = the width of the container for the list
/*
Based on the item you click on, this function
figures out the ending index of that particular item's row.
*/
function getRow(index){
//this is the number of items that can fit in a row
var row = Math.floor(box_width / work_width);
//var insertpoint = index + row;
@sortofsleepy
sortofsleepy / gist:7477655
Last active December 28, 2015 09:19
Fragment shader study #1
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 resolution;
void main(void){
vec2 position = (gl_FragCoord.xy / resolution.xy);
float color = 0.0;
@sortofsleepy
sortofsleepy / gist:7847046
Last active December 30, 2015 15:18
Fragment shader study #2
/**
Slits
@sortofsleepy
*/
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
@sortofsleepy
sortofsleepy / default3.2+shader
Last active August 29, 2015 13:57
A bare minimum set of shaders necessary to get something rendering in OpenGL 3.2+
/** ======= VERTEX SHADER ==============*/
#version 150
in vec4 position;
in vec2 texcoord;
uniform mat4 modelViewProjectionMatrix;
# WHY IS THIS DATA LIKE THIS BAY AREA BIKE SHARE!!!!??????
{
#INSTEAD OF 79707 WHY CAN IT NOT JUST SAY "Trip ID" LIKE IN THE README???
"79707":79709,
"453":582,
"11/1/2013 9:23":"11/1/2013 9:24",
"South Van Ness at Market":"Temporary Transbay Terminal (Howard at Beale)",
"66":55,
"11/1/2013 9:31":"11/1/2013 9:34",
@sortofsleepy
sortofsleepy / html
Created July 22, 2014 01:16
$watch testing
<div ng-app="watchApp" ng-controller="watchCtrl">
<div ng-repeat="a in b">
<input type="text" ng-model="a.value" />{{a.value}}
</div>
<div ng-repeat="a in c">
<input type="text" ng-model="a.value" />{{a.value}}
</div>