After an hour or so searching on the web to find and download this mysterious “P3D renderer” that was referenced to in the error message (rotateY() can only be used with a renderer that supports 3D, such as P3D or OPENGL.), I found an example of a 3D sketch in processing.js that provided me the solution.

Thanks to Andor Salga for this example: http://processingjs.org/content/learning/3D_ide/index.php

Apparently, to render a 3D object, I have to pass ‘P3D’ as the third argument in the size function, such as so:

void setup(){
  size(500, 500, P3D);
}

void draw(){  


translate(100, 80, 0); 
rotateY(0.5);
box(60);

}

Result in firefox is:

Perhaps I will bring it to someone’s attention that it is missing from the size function’s documentation page: http://processingjs.org/reference/size_
The sketch still doesn’t run in Processing 2.0. I mean it renders, but is buggy as the screen keeps flickering. Works perfectly in Firefox though, so I think I will continue using firefox to test my code for the 3D stuff.

So the target is in sight…I mean that literally, I can see the 3D cube, whose edges have to be rounded 🙂

Comment now!
















Trackbacks