summaryrefslogtreecommitdiffstats
path: root/sdl/gltools.c
diff options
context:
space:
mode:
Diffstat (limited to 'sdl/gltools.c')
-rw-r--r--sdl/gltools.c105
1 files changed, 104 insertions, 1 deletions
diff --git a/sdl/gltools.c b/sdl/gltools.c
index 756112b..7244f4b 100644
--- a/sdl/gltools.c
+++ b/sdl/gltools.c
@@ -6,7 +6,6 @@
*
*/
-#include "math3d.h"
#include "gltools.h"
GLint gltWriteTGA(const char *szFileName)
@@ -166,6 +165,110 @@ GLbyte *gltLoadTGA(const char *szFileName, GLint *iWidth, GLint *iHeight,
return pBits;
}
+void gltDrawSnowman(void)
+{
+ GLUquadricObj *pObj; /* quadric object */
+
+ /* main body */
+ glPushMatrix();
+ pObj = gluNewQuadric();
+ gluQuadricNormals(pObj, GLU_SMOOTH);
+
+ glPushMatrix();
+ glColor3f(1.0f, 1.0f, 1.0f);
+ gluSphere(pObj, .40f, 26, 13); /* bottom */
+
+ /* mid section */
+ glTranslatef(0.0f, .550f, 0.0f);
+ gluSphere(pObj, .3f, 26, 13);
+
+ /* head */
+ glTranslatef(0.0f, 0.45f, 0.0f);
+ gluSphere(pObj, 0.24f, 26, 13);
+
+ /* eyes */
+ glColor3f(0.0f, 0.0f, 0.0f);
+ glTranslatef(0.1f, 0.1f, 0.21f);
+ gluSphere(pObj, 0.02f, 26, 13);
+
+ glTranslatef(-0.2f, 0.0f, 0.0f);
+ gluSphere(pObj, 0.02f, 26, 13);
+
+ /* nose */
+ glColor3f(1.0f, 0.3f, 0.3f);
+ glTranslatef(0.1f, -0.12f, 0.0f);
+ gluCylinder(pObj, 0.04f, 0.0f, 0.3f, 26, 13);
+ glPopMatrix();
+
+ /* hat */
+ glPushMatrix();
+ glColor3f(0.0f, 0.0f, 0.0f);
+ glTranslatef(0.0f, 1.17f, 0.0f);
+ glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
+ gluCylinder(pObj, 0.17f, 0.17f, 0.4f, 26, 13);
+
+ /* hat brim */
+ glDisable(GL_CULL_FACE);
+ gluDisk(pObj, 0.17f, 0.28f, 26, 13);
+ glEnable(GL_CULL_FACE);
+
+ glTranslatef(0.0f, 0.0f, 0.40f);
+ gluDisk(pObj, 0.0f, 0.17f, 26, 13);
+ glPopMatrix();
+ glPopMatrix();
+
+ /* delete the quadric */
+ gluDeleteQuadric(pObj);
+}
+
+/* this screws up the rendering, possibly becasue it's glut? */
+void gltDrawFigures(void)
+{
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_LIGHTING);
+ glPushMatrix();
+ /* scale the figures */
+ glScalef(0.02f, 0.02f, 0.02f);
+
+ /* draw red cube */
+ glColor3f(1.0f, 0.0f, 0.0f);
+ glPushMatrix();
+ glutSolidCube(48.0f);
+ glPopMatrix();
+
+ /* draw green sphere */
+ glColor3f(0.0f, 1.0f, 0.0f);
+ glPushMatrix();
+ glTranslatef(-60.0f, 0.0f, 0.0f);
+ glutSolidSphere(25.0f, 50, 50);
+ glPopMatrix();
+
+ /* draw magenta torus */
+ glColor3f(1.0f, 0.0f, 1.0f);
+ glPushMatrix();
+ glTranslatef(0.0f, 0.0f, 60.0f);
+ glutSolidTorus(8.0f, 16.0f, 50, 50);
+ glPopMatrix();
+
+ /* draw yellow cone */
+ glColor3f(1.0f, 1.0f, 0.0f);
+ glPushMatrix();
+ glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
+ glTranslatef(60.0f, 0.0f, -24.0f);
+ glutSolidCone(25.0f, 50.0f, 50, 50);
+ glPopMatrix();
+
+ /* draw cyan teapot */
+ glColor3f(0.0f, 1.0f, 1.0f);
+ glPushMatrix();
+ glTranslatef(0.0f, 0.0f, -60.0f);
+ glutSolidTeapot(25.0f);
+ glPopMatrix();
+ glPopMatrix();
+ glEnable(GL_LIGHTING);
+ glEnable(GL_TEXTURE_2D);
+}
+
void gltDrawTriangle(void)
{
M3DVector3f vNormal;