ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/util.C
(Generate patch)

Comparing libgender/util.C (file contents):
Revision 1.31 by root, Sat Oct 16 12:33:46 2004 UTC vs.
Revision 1.32 by root, Sat Oct 16 23:23:21 2004 UTC

233#endif 233#endif
234} 234}
235 235
236namespace gl { 236namespace gl {
237 237
238 void draw_bbox (const view &ctx, const sector &a, const sector &b) 238 void gen_bbox (vertex_buffer_object &vb, const sector &a, const sector &b)
239 { 239 {
240 static GLint verts[] = { 240 static GLint verts[] = {
241 0x8000, 0x8004, 0x8006, 0x8002, // -x 241 0x8000, 0x8004, 0x8006, 0x8002, // -x
242 0x8001, 0x8003, 0x8007, 0x8005, // +x 242 0x8001, 0x8003, 0x8007, 0x8005, // +x
243 0x8000, 0x8001, 0x8005, 0x8004, // -y 243 0x8000, 0x8001, 0x8005, 0x8004, // -y
245 0x8000, 0x8002, 0x8003, 0x8001, // -z 245 0x8000, 0x8002, 0x8003, 0x8001, // -z
246 0x8004, 0x8005, 0x8007, 0x8006, // +z 246 0x8004, 0x8005, 0x8007, 0x8006, // +z
247 0 247 0
248 }; 248 };
249 249
250 glBegin (GL_QUADS);
251 point pa(a), pb(b); 250 point pa(a), pb(b);
251
252 vector<vertex_v3f> vd;
252 253
253 for (GLint *v = verts; *v; v++) 254 for (GLint *v = verts; *v; v++)
254 { 255 {
255 GLint mask = *v; 256 GLint mask = *v;
256 257
258 vd.push_back (point (
257 glVertex3f (mask & 1 ? pb.x : pa.x, 259 mask & 1 ? pb.x : pa.x,
258 mask & 2 ? pb.y : pa.y, 260 mask & 2 ? pb.y : pa.y,
259 mask & 4 ? pb.z : pa.z); 261 mask & 4 ? pb.z : pa.z
262 ));
260 } 263 }
261 264
262 glEnd (); 265 vb.set (vd);
263 } 266 }
264 267
265 int nesting; 268 int nesting;
266 269
267 void errchk (const char *name, const char *args, const char *file, int line) 270 void errchk (const char *name, const char *args, const char *file, int line)
276 if (inbegin) 279 if (inbegin)
277 return; 280 return;
278 281
279 GLenum gl_derror = glGetError (); 282 GLenum gl_derror = glGetError ();
280 if (gl_derror != GL_NO_ERROR) 283 if (gl_derror != GL_NO_ERROR)
284 {
281 fprintf (stderr, "%s:%d [GLERROR %d,%s] %s(%s)\n", 285 fprintf (stderr, "%s:%d [GLERROR %d,%s] %s(%s)\n",
282 file, line, gl_derror, gluErrorString (gl_derror), name, args); 286 file, line, gl_derror, gluErrorString (gl_derror), name, args);
287 abort ();
288 }
283 } 289 }
284 290
285} 291}
286 292
287//skedjuhlar main_scheduler; 293//skedjuhlar main_scheduler;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines