New issue

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

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

Already on GitHub? Sign in to your account

beginShape(POINT) vs beginShape(POINTS) #3776

Closed
clankill3r opened this Issue Sep 6, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@clankill3r

clankill3r commented Sep 6, 2015

It's related to the documentation. I opened an issue for that here:
processing/processing-docs#307

In short, the documentation shows as parameter POINT where it should be POINTS.

Using POINTS in P3D for example causes nothing to appear.

It would be really great if createShape does a simple to check.
For example:

PShape createShape(int kind) {
    if (kind == POINT) {
        // print warning or kind = POINTS

@benfry benfry added this to the 3.0 final milestone Sep 9, 2015

JakubValtar added a commit to JakubValtar/processing that referenced this issue Sep 9, 2015

@JakubValtar

This comment has been minimized.

Show comment
Hide comment
@JakubValtar

JakubValtar Sep 9, 2015

Contributor

I just fixed a bug where createShape would not take three parameters in 3D, but it is not the problem here.

We don't have createShape(int kind), there is only createShape(int type), which can be only GROUP, PShape.PATH or PShape.GEOMETRY.

Correct ways to create point shape are:

size(200, 200, P3D);

background(0);

strokeWeight(10);
stroke(255, 0, 255);

// Can be only one point
PShape s0 = createShape(POINT, 100, 100);

shape(s0);
size(200, 200, P3D);

background(0);

strokeWeight(10);
stroke(255, 128, 0);

// Can be multiple points
PShape s1 = createShape();
s1.beginShape(POINTS);
s1.vertex(66, 66);
s1.vertex(133, 133);
s1.endShape();

shape(s1);

You are right that reference needs to be more clear about this, but there is nothing we can do in the code. We can't check for createShape(POINT), because the POINT constant has the same value as PShape.PATH, which is valid.

Contributor

JakubValtar commented Sep 9, 2015

I just fixed a bug where createShape would not take three parameters in 3D, but it is not the problem here.

We don't have createShape(int kind), there is only createShape(int type), which can be only GROUP, PShape.PATH or PShape.GEOMETRY.

Correct ways to create point shape are:

size(200, 200, P3D);

background(0);

strokeWeight(10);
stroke(255, 0, 255);

// Can be only one point
PShape s0 = createShape(POINT, 100, 100);

shape(s0);
size(200, 200, P3D);

background(0);

strokeWeight(10);
stroke(255, 128, 0);

// Can be multiple points
PShape s1 = createShape();
s1.beginShape(POINTS);
s1.vertex(66, 66);
s1.vertex(133, 133);
s1.endShape();

shape(s1);

You are right that reference needs to be more clear about this, but there is nothing we can do in the code. We can't check for createShape(POINT), because the POINT constant has the same value as PShape.PATH, which is valid.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 11, 2015

Member

For 3.0 beta 6, changed the value of the PRIMITIVE, PATH, and GEOMETRY constants in PShape so that we can detect when a user (incorrectly) does this.

Member

benfry commented Sep 11, 2015

For 3.0 beta 6, changed the value of the PRIMITIVE, PATH, and GEOMETRY constants in PShape so that we can detect when a user (incorrectly) does this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment