i l try to render a shape and get "vertex(x,y,u,v)is not available with this renderer". I cannot find the mistake. I use version 1.5. The shape rotates, but when i press the mouse button in order to make a pdf of a frame, nothing happens.Can you help?
Thank you
import processing.pdf.*;
import processing.opengl.*;
PImage tex;
float rotx = PI/4;
float roty = PI/4;
// A boolean variable that when set to true triggers the PDF recording process
boolean recordPDF = false;
void setup()
{
size(640, 360, OPENGL);
tex = loadImage("uvtex.jpg");
textureMode(NORMALIZED);
fill(255);
stroke(color(44,48,32));
}
void draw()
{
// Begin making the PDF
if (recordPDF) {
beginRaw(PDF, "3D.pdf" ); // If you include "####" in the filename -- "3D-####.pdf" -- separate, numbered PDFs will be made for each frame that is rendered.
}
background(0);
noStroke();
translate(width/2.0, height/2.0, -100);
rotateX(PI*mouseY/height);
rotateY(PI*mouseX/width);
scale(90);
TexturedTriangle(tex);
}
void TexturedTriangle(PImage tex) {
beginShape(TRIANGLE_FAN);
texture(tex);
vertex(-1,-1,-1,0);
vertex( 1,-1,-1,0);
vertex( 0, 0, 1,1);
vertex( 1,-1,-1,0);
vertex( 1, 1,-1,0);
vertex( 0, 0, 1,1);
vertex( 1, 1,-1);
vertex(-1, 1,-1);
vertex( 0, 0, 1);
vertex(-1, 1,-1);
vertex(-1,-1,-1);
vertex( 0, 0, 1);
endShape();
// End making the PDF
if (recordPDF) {
endRaw();
recordPDF = false;
}
}
// Make the PDF when the mouse is pressed
void mousePressed() {
recordPDF = true;
}
Thank you
import processing.pdf.*;
import processing.opengl.*;
PImage tex;
float rotx = PI/4;
float roty = PI/4;
// A boolean variable that when set to true triggers the PDF recording process
boolean recordPDF = false;
void setup()
{
size(640, 360, OPENGL);
tex = loadImage("uvtex.jpg");
textureMode(NORMALIZED);
fill(255);
stroke(color(44,48,32));
}
void draw()
{
// Begin making the PDF
if (recordPDF) {
beginRaw(PDF, "3D.pdf" ); // If you include "####" in the filename -- "3D-####.pdf" -- separate, numbered PDFs will be made for each frame that is rendered.
}
background(0);
noStroke();
translate(width/2.0, height/2.0, -100);
rotateX(PI*mouseY/height);
rotateY(PI*mouseX/width);
scale(90);
TexturedTriangle(tex);
}
void TexturedTriangle(PImage tex) {
beginShape(TRIANGLE_FAN);
texture(tex);
vertex(-1,-1,-1,0);
vertex( 1,-1,-1,0);
vertex( 0, 0, 1,1);
vertex( 1,-1,-1,0);
vertex( 1, 1,-1,0);
vertex( 0, 0, 1,1);
vertex( 1, 1,-1);
vertex(-1, 1,-1);
vertex( 0, 0, 1);
vertex(-1, 1,-1);
vertex(-1,-1,-1);
vertex( 0, 0, 1);
endShape();
// End making the PDF
if (recordPDF) {
endRaw();
recordPDF = false;
}
}
// Make the PDF when the mouse is pressed
void mousePressed() {
recordPDF = true;
}
1