FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   vertex() vs. line()
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: vertex() vs. line()  (Read 712 times)
flight404

WWW Email
vertex() vs. line()
« on: Dec 16th, 2004, 2:50am »

If I am drawing a line between 2 points, is it faster or slower or the same if I use beginShape(LINE) with 2 vertices or use line()?
 
Additionally, why isn't it possible to throw a line() statement inside of a beginShape() endShape() process?  I don't want to interrupt the shape I am drawing... just wanted to throw a line in the middle of it.
 
REAS


WWW
Re: vertex() vs. line()
« Reply #1 on: Dec 16th, 2004, 7:32pm »

Peeking inside the Processing code reveals the line function is calling this:
 
Code:

  public void line(float x1, float y1, float x2, float y2) {
    beginShape(LINES);
    vertex(x1, y1);
    vertex(x2, y2);
    endShape();
  }

 
Therefore, using line() is a light bit of overehead and will not be as fast. This bit of code also reveals the issue with calling line() inside beginShape().
 
flight404

WWW Email
Re: vertex() vs. line()
« Reply #2 on: Dec 16th, 2004, 7:39pm »

Okay.  Makes sense.  Fair enough.
 
Pages: 1 

« Previous topic | Next topic »