diff options
Diffstat (limited to 'src/mapUtils.cpp')
| -rw-r--r-- | src/mapUtils.cpp | 15 |
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 |
