Skip to content

Instantly share code, notes, and snippets.

@Samsy
Samsy / alphafbo.cpp
Created June 3, 2016 13:16 — forked from HalfdanJ/alphafbo.cpp
ofFbo with premultiplied alpha
// Kudos to armadilly
fbo.begin();
///pre-multiply background color of the fbo for correct blending!
ofClear(ofColor(fboBgColor * (fboBgColor.a / 255.) , fboBgColor.a));
//Set this blending mode for anything you draw INSIDE the fbo
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
//your draw code here!
fbo.end();
@Samsy
Samsy / GLSL-Math.md
Created May 13, 2016 15:13 — forked from patriciogonzalezvivo/GLSL-Math.md
GLSL Math functions

Trigonometry

const float PI = 3.1415926535897932384626433832795;
const float PI_2 = 1.57079632679489661923;
const float PI_4 = 0.785398163397448309616;

float PHI = (1.0+sqrtf(5.0))/2.0;
@Samsy
Samsy / GIF-Screencast-OSX.md
Created May 4, 2016 15:25 — forked from nayed/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@Samsy
Samsy / branch one
Last active May 3, 2016 16:03
Branching
varying vec2 vUv;
uniform sampler2D tDiffuse;
uniform float isPicking;
uniform vec3 pickingColor;
void main() {
vec3 color = texture2D(tDiffuse, vUv).rgb;
gl_FragColor = vec4(color, 1.0);
@Samsy
Samsy / gist:096fb2916dae6c9f6c4ebaa062e89983
Created April 12, 2016 10:49
CSS 3D RENDERER IE FIX
import THREE from 'three'
import Config from 'config'
let config = Config.instance
var isLow = false
@Samsy
Samsy / css3Drenderer.js
Created March 28, 2016 22:15
CSS3DRENDERER THREEJS SAFARI AND INTERNET EXPLORER 11
import THREE from 'three'
import Config from 'config'
let config = Config.instance
let parameters = {
parameters : false,
addTouchEvent() {
console.log('readd')
this.wrapper = document.querySelector('.wrapper')
let bla = ["touchstart", "touchend", "touchmove"]
bla.forEach( (func)=> {
this.tInput = this.webGL_createTexture(2048.0, this.GL.RGBA, this.GL.NEAREST, this.GL.NEAREST, this.GL.UNSIGNED_BYTE, true);
WebglFrag.prototype.webGL_createTexture = function(textureSize, format, maxFilter, minFilter, type, unBind) {
var texture = this.GL.createTexture();
texture.size = textureSize;
this.GL.bindTexture(this.GL.TEXTURE_2D, texture);
var ncp = require('ncp').ncp;
var copyobj = require('../package.json').copy;
for (var prop in copyobj) {
ncp(copyobj[prop].src, copyobj[prop].dest, function (err) {
if (err) {
return console.error(err);
@Samsy
Samsy / README.md
Created January 13, 2016 18:19 — forked from superguigui/README.md
Three-orbit-controls with rotation set methods

I added a few methods to three-orbit-controls to be able to manually define phi or theta and be able to rotate to a given point.

// rotation in Y
controls.setAzimuthalAngle(theta);

// rotation in X
controls.setPolarAngle(phi);