Shapes3D blocks pc if texturing video.

edited November 2015 in Library Questions

Hi, I wanted to try to texture a video on a box faces. worked at first try, but if I try to set on what faces to texture, it blocks my computer, and I have to hard-reset. Is it normal? here's my code:

import shapes3d.*;
import shapes3d.animation.*;
import shapes3d.utils.*;

import processing.video.*;

Movie mov;

Shape3D[] shapes; 
Box box;

int shapesNumTot = 1;
float angleX, angleY, angleZ;

void setup() {
  size(800, 600, P3D);

  mov = new Movie(this, "video.mp4");
  mov.loop();
  textureMode(NORMAL);

  shapes = new Shape3D[shapesNumTot];

  box = new Box(this);
  //box.setTexture(mov, Box.FRONT); // if I try this instead it blocks my PC.
  box.setTexture(mov); // this works as expected..
  box.setSize(100, 200, 400);
  box.drawMode(S3D.TEXTURE); 
  shapes[0] = box;
}

void draw() {
  background(100);
  pushMatrix();
  camera(0, 0, 300, 0, 0, 0, 0, 1, 0);
  angleX += radians(0.913f);
  angleY += radians(0.799f);
  angleZ += radians(1.213f);
  rotateX(angleX);
  rotateY(angleY);
  rotateZ(angleZ);
  for (int i = 0; i < shapesNumTot; i++) {
    shapes[i].draw();
  }
  popMatrix();
}

void movieEvent(Movie m) {
  m.read();
}

Thanks, Davide.

Answers

  • Answer ✓

    I tried your code using my own mp4 file, Processing 3 and the latest version of Shapes 3D (V2.2) on OSX.

    It worked perfectly for me getting 60fps so I am not sure what the problem is. Do you get any errors messages?

  • arghh..no, because i cannot click anywhere, the sketch doesn't even start! here working in linuxmint 17.2 processing 3 and latest library versions. By now I solved writing my classes drawing face by face. it gives me even more flexibility.

    Happy it normally works (at least on mac..) Thanks.

  • i did the same thing that quark did and it work for me to, you did good i think theres a issue with your video, reset and try again with another mp4.

Sign In or Register to comment.