3 // - do we need a file for each object....yes!
10 #include <GL/gl.h> // Header File For The OpenGL32 Library
11 #include <GL/glu.h> // Header File For The GLu32 Library
14 #include "gldrawlib.h"
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
31 DriverObjects CURRENT_OBJECT
=
33 init_wirebox
, // init, must be called first
34 compile_wirebox
, // compile
36 render_wirebox
, // render to scene
41 //=========================================================
42 static void draw_wirebox(void)
46 glColor3f(1.0f
, 1.0f
, 1.0f
);
47 glBegin(GL_LINE_LOOP
);
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
55 glVertex3f(-size
, 0.0f
, -size
);
56 glVertex3f(-size
, size
, -size
);
57 glVertex3f( size
, size
, -size
);
58 glVertex3f( size
, 0.0f
, -size
);
61 glVertex3f(-size
, size
, -size
);
62 glVertex3f(-size
, size
, size
);
63 glVertex3f( size
, size
, size
);
64 glVertex3f( size
, size
, -size
);
67 glVertex3f(-size
, 0.0f
, -size
);
68 glVertex3f( size
, 0.0f
, -size
);
69 glVertex3f( size
, 0.0f
, size
);
70 glVertex3f(-size
, 0.0f
, size
);
73 glVertex3f( size
, 0.0f
, -size
);
74 glVertex3f( size
, size
, -size
);
75 glVertex3f( size
, size
, size
);
76 glVertex3f( size
, 0.0f
, size
);
79 glVertex3f(-size
, 0.0f
, -size
);
80 glVertex3f(-size
, 0.0f
, size
);
81 glVertex3f(-size
, size
, size
);
82 glVertex3f(-size
, size
, -size
);
85 } // end of the function
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)
112 glCallList(CURRENT_OBJECT
.call_id
);
116 } // end of the function
118 //=========================================================
120 //=========================================================
121 static void compile_wirebox(void)
124 // setup a spot for display list for background
125 //object = getcurrentobject();
126 id
= CURRENT_OBJECT
.call_id
;
129 glNewList(id
, GL_COMPILE
);
131 // call drawing function
132 // but this may method make it a little better
133 CURRENT_OBJECT
.draw();
137 } // end of the function