Main Page Namespace List Class Hierarchy Alphabetical List Data Structures File List Namespace Members Data Fields Globals

# ExPredefinedObject.cpp

Go to the documentation of this file.

    00001 /*
    00002  * ExNihilo 3D Engine
    00003  *
    00004  *  This program is free software; you can redistribute it and/or modify
    00005  *  it under the terms of the GNU General Public License as published by
    00006  *  the Free Software Foundation; either version 2 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  This program is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  *
    00018  * Please read AUTHORS file !!!
    00019  *
    00020  * $Id: ExPredefinedObject.cpp,v 1.5 2002/07/02 15:40:32 data Exp $
    00021  *
    00022  */
    00023
    00024 #include "ExPredefinedObject.h"
    00025
    00026 void InitBasicObjectList(void)
    00027 {
    00028         float i;
    00029         glNewList(GRILLE,GL_COMPILE);
    00030         glDisable(GL_LIGHTING);
    00031         glBegin(GL_LINES);
    00032                 glColor3f(1.0f,0.0f,0.0f);
    00033                 for ( i=-100;i<101;i++)
    00034                 {
    00035                         glVertex3f(0.0f,      i, 100.0f);
    00036                         glVertex3f(0.0f,      i,-100.0f);
    00037                         glVertex3f(0.0f, 100.0f,      i);
    00038                         glVertex3f(0.0f,-100.0f,      i);
    00039                 }
    00040                 glColor3f(0.0,1.0f,0.0f);
    00041
    00042                 for ( i=-100;i<101;i++)
    00043                 {
    00044                         glVertex3f( 100.0f,     i,0.0f);
    00045                         glVertex3f(-100.0f,     i,0.0f);
    00046                         glVertex3f(     i, 100.0f,0.0f);
    00047                         glVertex3f(     i,-100.0f,0.0f);
    00048                 }
    00049                 glColor3f(0.0,0.0f,1.0f);
    00050                 for (i=-100;i<101;i++)
    00051                 {
    00052                         glVertex3f( 100.0f,0.0f,      i);
    00053                         glVertex3f(-100.0f,0.0f,      i);
    00054                         glVertex3f(      i,0.0f, 100.0f);
    00055                         glVertex3f(      i,0.0f,-100.0f);
    00056                 }
    00057         glEnd();
    00058         glEnable(GL_LIGHTING);
    00059         glEndList();
    00060
    00061
    00062 }
    00063
    00064 void RenderBitmapString(float x, float y, void *font,const char *string)
    00065 {
    00066         const char *c;
    00067         glRasterPos2f(x, y);
    00068         for (c=string; *c != '\0'; c++)
    00069         {
    00070            glutBitmapCharacter(font, *c);
    00071         }
    00072 }
    00073
    00074 void EnterOrthoMode(void)
    00075 {
    00076         glMatrixMode(GL_PROJECTION);
    00077         glPushMatrix();
    00078         glLoadIdentity();
    00079         glOrtho( 0,glutGet(GLUT_WINDOW_WIDTH),glutGet(GLUT_WINDOW_HEIGHT),0,0,1);
    00080         glMatrixMode(GL_MODELVIEW);
    00081         glLoadIdentity();
    00082 }
    00083
    00084 void LeaveOrthoMode(void)
    00085 {
    00086         glMatrixMode( GL_PROJECTION );
    00087         glPopMatrix();
    00088         glMatrixMode( GL_MODELVIEW );
    00089 }