summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sdl/pyramid.c22
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();