2D Shapes

v0.1.6
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle
yThe y position of the circle
dThe diameter of the circle

See circle in shapes.h
rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle
yThe y position of the reactangle
wThe width
hThe height

See rect in shapes.h
square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square
yThe y position of the square
sThe size of the square

See square in shapes.h
line(x1, y1, x2, y2);

Draw a line to the opengl context

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point

See line in shapes.h
quad(x1, y1, x2, y2, x3, y3, x4, y4);

Draw a quad on the screen

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point
x3The x position of the third point
y3The y position of the third point
x4The x position of the fourth point
y4The y position of the fourth point

See quad in shapes.h
point();

Draw a point on the screen

See point in shapes.h
arc();

Draw an arc on the screen

See arc in shapes.h
ellipse();

Draw an ellipse on the screen

See ellipse in shapes.h
triangle();

Draw a triangle on the screen

See triangle in shapes.h
beginShape(mode);

Begin adding vertices to a custom shape

Arguments

modeThe opengl shape mode LINES, POINTS, QUADS, TRIANGLES, TRIANGLE_FAN

The following would draw a 100 by 100 square at position 100, 100 The following would draw a 100 by 100 square at position 100, 100

beginShape(QUADS);
  vertex(100, 100);
  vertex(100, 200);
  vertex(200, 200);
  vertex(200, 100);
endShape();
See beginShape in shapes.h
vertex(x, y);

beginShape must be called prior
Adding a vertex to a custom shape

Arguments

xThe x position
yThe y position

See vertex in shapes.h
endShape();

beginShape must be called prior
Close the custom shape

See endShape in shapes.h