Skip to content

Instantly share code, notes, and snippets.

View wrightwriter's full-sized avatar
:shipit:
writing singletons

Petar Guglev wrightwriter

:shipit:
writing singletons
View GitHub Profile
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active November 19, 2024 20:51
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@kirkbackus
kirkbackus / sine.js
Created May 14, 2016 13:05
A simple implementation of a sine wave generator using the web-audio API
function Sine(ctx) {
this.sampleRate = ctx.sampleRate;
this.processor = ctx.createScriptProcessor(512,0,1)
this.processor.connect(ctx.destination);
this.offset = 0;
}
Sine.prototype.play = function(freq) {
this.processor.onaudioprocess = function(e) {
var out = e.outputBuffer.getChannelData(0);
@AloofBuddha
AloofBuddha / associations.md
Last active February 27, 2024 08:25
Sequelize Relationships: hasOne vs belongsTo
@nickrolfe
nickrolfe / windows_modern_opengl_context.c
Last active October 13, 2024 00:03
Sample code showing how to create a window using a modern OpenGL core profile context without any libraries other than the standard Win32 wglXXX calls.
// Sample code showing how to create a modern OpenGL window and rendering context on Win32.
#include <windows.h>
#include <gl/gl.h>
#include <stdbool.h>
typedef HGLRC WINAPI wglCreateContextAttribsARB_type(HDC hdc, HGLRC hShareContext,
const int *attribList);
wglCreateContextAttribsARB_type *wglCreateContextAttribsARB;
@patriciogonzalezvivo
patriciogonzalezvivo / toGif.sh
Created February 12, 2017 14:57
Frag Shader to gif
#!/bin/bash
SHADER=$1
SEC=$1
COUNTER=0
for i in `seq -w 0.01 .031 $SEC`; do
echo $i
`glslViewer $SHADER -s $i -o frame-$COUNTER.png`
let COUNTER=COUNTER+1
@rvega
rvega / main.cpp
Created April 9, 2018 02:07
Rendering video content with libvlc to an openGL texture.
#include <mutex>
#include <vlc/vlc.h>
#include <stb_image.h>
#include <nanogui/nanogui.h>
class VideoView: public nanogui::GLCanvas {
public:
nanogui::GLShader shader;
GLuint textureId;
PGraphics tex;
PImage src;
float t;
float size = 1920/8;
float w = size*2;
float h = sqrt(3)*size;
float xstep = w*(3/4f);
float ystep = h;
int hexCountX;