Initial Import
[glAntsMech.git] / glants_mech / win32 / glAntsV05 / wirebox.cpp
blobbb75cb94e21978a416357c1c2aef92da136dc21b
1 //
2 // wirebox.cpp
3 // - do we need a file for each object....yes!
4 //
6 #include <windows.h>
7 #include <stdio.h>
8 #include <stdlib.h>
10 #include <gl\gl.h> // Header File For The OpenGL32 Library
11 #include <gl\glu.h> // Header File For The GLu32 Library
12 #include <gl\glaux.h> // Header File For The Glaux Library
14 #include "gldrawlib.h"
15 #include "objects.h"
17 #undef CURRENT_OBJECT
18 #define CURRENT_OBJECT wirebox
20 static void init_wirebox(int list_id);
21 static void compile_wirebox(void);
22 static void draw_wirebox(void);
23 static void render_wirebox(void);
24 static void draw_wirebox(void);
27 // simple objects library
28 // - make sure to change the number of objects
29 // in objects.h
31 DriverObjects CURRENT_OBJECT =
33 init_wirebox, // init, must be called first
34 compile_wirebox, // compile
35 draw_wirebox, // draw
36 render_wirebox, // render to scene
37 0 // loaded by INIT
41 //=========================================================
42 static void draw_wirebox(void)
44 float size = 0.4f;
46 glColor3f(1.0f, 1.0f, 1.0f);
47 glBegin(GL_LINE_LOOP);
48 // Front Face
49 glVertex3f(-size, 0.0f, size); // left bottom
50 glVertex3f( size, 0.0f, size); // right bottom
51 glVertex3f( size, size, size); // top right
52 glVertex3f(-size, size, size); // top left
53 // Back Face
55 glVertex3f(-size, 0.0f, -size);
56 glVertex3f(-size, size, -size);
57 glVertex3f( size, size, -size);
58 glVertex3f( size, 0.0f, -size);
60 // Top Face
61 glVertex3f(-size, size, -size);
62 glVertex3f(-size, size, size);
63 glVertex3f( size, size, size);
64 glVertex3f( size, size, -size);
66 // Bottom Face
67 glVertex3f(-size, 0.0f, -size);
68 glVertex3f( size, 0.0f, -size);
69 glVertex3f( size, 0.0f, size);
70 glVertex3f(-size, 0.0f, size);
72 // Right face
73 glVertex3f( size, 0.0f, -size);
74 glVertex3f( size, size, -size);
75 glVertex3f( size, size, size);
76 glVertex3f( size, 0.0f, size);
78 // Left Face
79 glVertex3f(-size, 0.0f, -size);
80 glVertex3f(-size, 0.0f, size);
81 glVertex3f(-size, size, size);
82 glVertex3f(-size, size, -size);
83 glEnd();
85 } // end of the function
89 // init
90 // - load anything special about the
91 // one important function
93 static void init_wirebox(int list_id)
96 CURRENT_OBJECT.visible = 1;
98 // store the id through the function
99 // there is probably a better way to do this
100 CURRENT_OBJECT.call_id = list_id;
102 } // end of the functino
105 //=========================================================
106 // Now the function to actually draw it
107 //=========================================================
108 static void render_wirebox(void)
110 //glPushMatrix();
112 glCallList(CURRENT_OBJECT.call_id);
114 //glPopMatrix();
116 } // end of the function
118 //=========================================================
119 // compile
120 //=========================================================
121 static void compile_wirebox(void)
123 int id;
124 // setup a spot for display list for background
125 //object = getcurrentobject();
126 id = CURRENT_OBJECT.call_id;
128 // apply list
129 glNewList(id, GL_COMPILE);
131 // call drawing function
132 // but this may method make it a little better
133 CURRENT_OBJECT.draw();
135 glEndList();
137 } // end of the function