Skip to content

Instantly share code, notes, and snippets.

@flordefuego
Created February 23, 2023 13:28
Show Gist options
  • Select an option

  • Save flordefuego/ca956a0197894bf6bac7cbb68e05ec5a to your computer and use it in GitHub Desktop.

Select an option

Save flordefuego/ca956a0197894bf6bac7cbb68e05ec5a to your computer and use it in GitHub Desktop.
/*
_hydra_texture // cc ojack.xyz + teddavis.org 2021
edit hydra code within // hydraSandbox tags for changes w/o recompiling p5!
cheatsheets: https://ojack.xyz/hydra-functions/ + https://hydra-book.naotohieda.com/
*/
let img;
let genie;
function preload() {
img = loadImage('https://raw.githubusercontent.com/flordefuego/test_to_upload_stuff/main/genie.png');
genie = loadModel('https://raw.githubusercontent.com/flordefuego/test_to_upload_stuff/main/genie.obj')
}
let libs = ['https://unpkg.com/hydra-synth', 'includes/libs/hydra-synth.js']
// hydra canvas + init
let hc = document.createElement('canvas') // hydra canvas + custom size
hc.width = 1280
hc.height = 720
let hydra = new Hydra({detectAudio: false,canvas: hc})
let pg // store hydra texture
// sandbox - start
//s0.initScreen()
osc().out(o0)
// sandbox - stop
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL)
//background(0)
pg = createGraphics(hc.width, hc.height)
//noStroke()
}
function draw() {
// grab + apply hydra texture
pg.clear()
pg.drawingContext.drawImage(hc, 0, 0, pg.width, pg.height)
//fill(0,0,0,1)
//plane(width, height) // fill screen w/ texture
texture(pg)
orbitControl();
//rotateX(radians(frameCount / 8))
//rotateY(radians(frameCount / 4))
//normalMaterial()
sphere(width,height)
//normalMaterial()
//stroke(0,255,155)
noStroke()
texture(img)
//cone(width/8,height)
scale(100)
model(genie)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment