summaryrefslogtreecommitdiff
path: root/src/mapUtils.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2012-03-23 01:41:25 +0000
committerTim Redfern <tim@eclectronics.org>2012-03-23 01:41:25 +0000
commitec078a99e2924c1709242f981651409f7ae9e940 (patch)
tree53c9f71aa378ebaaf24aa77c9624e18803bbaeed /src/mapUtils.cpp
parent79c3cd01ef47524e80bd2d242807ad60c5de1e0d (diff)
working with arduino
Diffstat (limited to 'src/mapUtils.cpp')
-rw-r--r--src/mapUtils.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mapUtils.cpp b/src/mapUtils.cpp
index 3dd3d7c..d250c98 100644
--- a/src/mapUtils.cpp
+++ b/src/mapUtils.cpp
@@ -139,3 +139,18 @@ void drawBoard(float x,float y,float z) {
glEnd();
glPopMatrix();
}
+void drawCylinder(float r,float h,float x,float y,float z) {
+ glPushMatrix();
+ glTranslated(x,y,z);
+ glBegin(GL_QUADS);
+ float step=TWO_PI/50.0;
+ float txstep=1.0/50.0;
+ for (float i=0,j=0;i<=TWO_PI;i+=step,j+=txstep) {
+ glTexCoord2f(j,0); glVertex3f(cos(i)*r, 0, sin(i)*r);
+ glTexCoord2f(j,1); glVertex3f(cos(i)*r, -h, sin(i)*r);
+ glTexCoord2f(j+txstep,1); glVertex3f(cos(i+step)*r, -h, sin(i+step)*r);
+ glTexCoord2f(j+txstep,0); glVertex3f(cos(i+step)*r, 0, sin(i+step)*r);
+ }
+ glEnd();
+ glPopMatrix();
+} \ No newline at end of file