Code:
import processing.opengl.*;
import controlP5.*;
ControlP5 controlP5;
PImage img;
void setup(){
size(w, h, P3D);
frameRate(25);
noStroke();
PImage img = loadImage("kid.jpg");
//fs = new FullScreen(this);
//fs.enter();
controlP5 = new ControlP5(this);
controlP5.addNumberbox("Y3",0,40,60,40,20);
controlP5.addNumberbox("Y4",0,100,60,40,20);
controlP5.addNumberbox("Y",0,40,100,40,20);
controlP5.addNumberbox("Y2",0,100,100,40,20);
controlP5.addSlider("bgknop",0, 200, achtergrond, 20, h-40, 100, 20);
controlP5.addNumberbox("X",0,40,130,40,20);
controlP5.addToggle("toggle",true,30,h-160,20,20);
controlP5.addNumberbox("X2",0,100,130,40,20);
controlP5.addNumberbox("Z",0,40,160,40,20);
controlP5.addNumberbox("Z2",0,100,160,40,20);
}
void draw(){
background(achtergrond);
controlP5.draw();
if(toggle==true){
fill(255);
stroke(30);
noSmooth();
rect(w/2+30, 30, w/2-60, h/2-60);
rect(w/2+30, h/2+30, w/2-60, h/2-60);
drawGrid();
drawCubeGrid();
}
else if(toggle==false){
redraw();
for(int i = 0; i < 4 ; i++){
X2[i] = X[i]+(w/2);
Y2[i] = Z[i]+(h/2);
Z2[i] = Y[i]+(w/2);
}
TexturedQuad();
}
}
void TexturedQuad() {
textureMode(NORMALIZED);
beginShape();
texture(img);
vertex(X2[0],Y2[0],Z2[0],0,0);
vertex(X2[2],Y2[2],Z2[2],1,0);
vertex(X2[3],Y2[3],Z2[3],1,1);
vertex(X2[1],Y2[1],Z2[1],0,1);
endShape();
}
It works fine when I leave out the u,v coordinates. If I need to post the full code you let me know. Maybe the controlP5 library is conflicting. I really appreciate the fast response. btw maybe you already noticed from the code but I'm not really 'a programmer'.