Texture a rect
in
Processing with Other Languages
•
2 years ago
Hello,
I want to texture a rect. I see an exemple here :
http://www.processing.org/learning/3d/texture1.html.
But when I try on my computer, it don't work. I have on error in firebug :
- Index or size is negative or greater than the allowed amount" code: "1
- setlwh()login?...estions (ligne 417)
- (?)()login?...estions (ligne 1)
- event = load
- parent.lwh(li.offsetWidth + 5, li.offsetHeight + 5);
-
<html>
-
<head>
-
<script language="javascript" src="processing.init.js"></script>
-
<script language="javascript" src="processing.js"></script>
-
</head>
-
<body>
-
<script type="application/processing">
-
PImage img;
-
void setup() {
-
size(600, 600, OPENGL);
-
img = loadImage("sunflower.jpg");
-
noStroke();
-
}
-
void draw() {
-
background(0);
-
translate(width / 2, height / 2);
-
rotateY(map(mouseX, 0, width, -PI, PI));
-
rotateZ(PI/6);
-
beginShape();
-
texture(img);
-
vertex(-1, -1, 0, 0, 0);
-
vertex(1, -1, 0, 1, 0);
-
vertex(1, 1, 0, 1, 1);
-
vertex(-1, 1, 0, 0, 1);
-
endShape();
-
}
-
</script>
-
<canvas></canvas>
-
</body>
-
</html>
Thanks.
1