Web Uploading Issue

edited March 2017 in JavaScript Mode

This works perfectly in processing, but only the background shows up when I upload it to an html file. I've tried multiple ways of uploading and the files are properly linked Does anyone know how I can fix this? Thanks!

/* @pjs preload="ToxicTots.jpg","spine.jpg","top.jpg", "bottom.jpg"; */

PImage tex1; PImage tex2; PImage tex3; PImage tex4;

float rotx = PI/4; float roty = PI/4;

void setup() { size(800, 900, P3D); tex1 = loadImage("ToxicTots.jpg"); tex2 = loadImage("spine.jpg");
tex3 = loadImage("top.jpg");
tex4 = loadImage("bottom.jpg"); textureMode(NORMAL); fill(255); stroke(color(44,48,32)); }

void draw() { background(176,224,230); noStroke(); translate(width/2.0, height/3.0, -100); rotateX(rotx); rotateY(roty); scale(200); TexturedCube(tex1);
TexturedCube(tex2);
TexturedCube(tex3); TexturedCube(tex4); }

void TexturedCube(PImage tex) { beginShape(QUADS);

// +Z "front" face texture(tex1); vertex(-.25, -1, 1, 0, 0); vertex( 1, -1, 1, 1, 0); vertex( 1, 1, 1, 1, 1); vertex(-.25, 1, 1, 0, 1);

// -Z "back" face texture(tex1); vertex( 1, -1, .75, 0, 0); vertex(-.25, -1, .75, 1, 0); vertex(-.25, 1, .75, 1, 1); vertex( 1, 1, .75, 0, 1); endShape();

// +Y "bottom" face
beginShape(QUADS); texture(tex3); vertex(-.25, 1, 1, 0, 0); vertex( 1, 1, 1, 1, 0); vertex( 1, 1, .75, 1, 1); vertex(-.25, 1, .75, 0, 1); endShape();

// -Y "top" face beginShape(QUADS);
texture(tex4); vertex(-.25, -1, 1, 0, 0); vertex( 1, -1, 1, 1, 0); vertex( 1, -1, .75, 1, 1); vertex(-.25, -1, .75, 0, 1); endShape();

// +X "right" face beginShape(QUADS); texture(tex2); vertex( 1, -1, 1, 0, 0); vertex( 1, -1, .75, 1, 0); vertex( 1, 1, .75, 1, 1); vertex( 1, 1, 1, 0, 1);

// -X "left" face vertex(-.25, -1, 1, 0, 0); vertex(-.25, -1, .75, 1, 0); vertex(-.25, 1, .75, 1, 1); vertex(-.25, 1, 1, 0, 1); endShape(); }

void mouseDragged() { float rate = 0.01; rotx += (pmouseY-mouseY) * rate; roty += (mouseX-pmouseX) * rate; }

Answers

Sign In or Register to comment.