Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

support static sketches with size() #51

Closed
jeremydouglass opened this issue May 12, 2017 · 1 comment
Closed

support static sketches with size() #51

jeremydouglass opened this issue May 12, 2017 · 1 comment

Comments

@jeremydouglass
Copy link
Member

jeremydouglass commented May 12, 2017

size() does not appear to work with Processing.R static sketches.

Currently the "hello-processing.R" is an example is what Processing calls a static sketch:

A program written as a list of statements (like the previous examples) is called a static sketch. In a static sketch, a series of functions are used to perform tasks or create a single image without any animation or interaction. Interactive programs are drawn as a series of frames, which you can create by adding functions titled setup() and draw() as shown in the code below. -
https://processing.org/tutorials/overview/

Because size() does not work with static sketches, they cannot use 3D (using the P3D OpenGL renderer). For example, here is a static sketch in Processing(Java) showing how box() works:

size(100, 100, P3D);
translate(58, 48, 0); 
rotateY(0.5);
noFill();
box(40, 20, 50);

Here is the equivalent sketch in the current Processing.R without static size():

P3D <- "processing.opengl.PGraphics3D"
settings <- function() {
 processing$size(100, 100, P3D)
}
setup <- function() {
  processing$noLoop()
}
draw <- function() {
  processing$translate(58, 48, 0)
  processing$rotateY(0.5)
  processing$noFill()
  processing$box(40, 20, 50)
}
# based on https://processing.org/reference/box_.html

Supporting size() in Processing.R static sketches will make example code and documentation much more concise -- which will make it easier to read for learners.

@jeremydouglass jeremydouglass changed the title support static sketches with size support static sketches with size() May 12, 2017
@gaocegege
Copy link
Member

Yeah, I think it is a bug and I will try to fix it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants