diff options
author | Kamil Kaminski <nfm@phenon.localdomain> | 2010-10-03 16:37:22 -0500 |
---|---|---|
committer | Kamil Kaminski <nfm@phenon.localdomain> | 2010-10-03 16:37:22 -0500 |
commit | 36ec1b47394620aa3126127e35ab829f18e5e738 (patch) | |
tree | e15d3b6c89339f905c6fcda89683d97b5e3bdb21 | |
parent | 894049e3830679b9e04f711f7e8b106db6daeafd (diff) | |
download | GLPyramid-36ec1b47394620aa3126127e35ab829f18e5e738.tar.gz GLPyramid-36ec1b47394620aa3126127e35ab829f18e5e738.tar.bz2 GLPyramid-36ec1b47394620aa3126127e35ab829f18e5e738.zip |
pyramid: draw ground
-rw-r--r-- | sdl/pyramid.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sdl/pyramid.c b/sdl/pyramid.c index b25d073..b2c9696 100644 --- a/sdl/pyramid.c +++ b/sdl/pyramid.c @@ -159,6 +159,24 @@ void processEvents() } } +static void draw_ground(void) +{ + GLfloat fExtent = 20.0f; + GLfloat fStep = 0.5f; + GLfloat y = -0.4f; + GLfloat iLine; + + glBegin(GL_LINES); + for (iLine = -fExtent; iLine <= fExtent; iLine += fStep) + { + glVertex3f(iLine, y, fExtent); + glVertex3f(iLine, y, -fExtent); + glVertex3f(fExtent, y, iLine); + glVertex3f(-fExtent, y, iLine); + } + glEnd(); +} + static void render(void) { M3DVector3f vNormal; @@ -176,7 +194,7 @@ static void render(void) /* save the matrix state and do the rotations */ glPushMatrix(); /* move object back and do in place rotation */ - glTranslatef(0.0f, 0.4f, -4.0f); + glTranslatef(0.0f, 0.2f, -3.5f); glRotatef(xRot, 1.0f, 0.0f, 0.0f); glRotatef(yRot, 0.0f, 1.0f, 0.0f); @@ -244,6 +262,8 @@ static void render(void) /* restore the matrix state */ glPopMatrix(); + + draw_ground(); /* buffer swap */ SDL_GL_SwapBuffers(); |