// // Draw an axis aligned bounding box // void OutlineBox(const BoundingBox &box, const Vector &v, Color c) { v; VertexTL verts[8]; SetupVerts(verts, box, c); RenderBoxEdges(verts); }
// // Draw an arbitrarily aligned bounding box // void OutlineBox(const BoundingBox &box, const Matrix &m, Color c) { VertexTL verts[8]; SetupVerts(verts, box, c); RenderBoxEdges(verts, &m); }
static void Init( void ) { GLint errno; GLuint prognum; int color_size = 4; static const char *prog1 = "!!ARBvp1.0\n" "PARAM mvp[4] = {state.matrix.mvp};\n" "DP4 result.position.x, vertex.position, mvp[0]; \n" "DP4 result.position.y, vertex.position, mvp[1]; \n" "DP4 result.position.z, vertex.position, mvp[2]; \n" "DP4 result.position.w, vertex.position, mvp[3]; \n" "MOV result.color, vertex.color;\n" "END\n"; #ifndef GL_ARB_vertex_type_2_10_10_10_rev fprintf(stderr,"built without ARB_vertex_type_2_10_10_10_rev\n"); exit(1); #endif if (!glutExtensionSupported("GL_ARB_vertex_type_2_10_10_10_rev")){ fprintf(stderr,"requires ARB_vertex_type_2_10_10_10_rev\n"); exit(1); } glGenProgramsARB(1, &prognum); glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(prog1), (const GLubyte *) prog1); assert(glIsProgramARB(prognum)); errno = glGetError(); if (errno != GL_NO_ERROR) { GLint errorpos; glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); printf("errorpos: %d\n", errorpos); printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); } glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_COLOR_ARRAY ); SetupVerts(); glGenBuffersARB(1, &arrayObj); glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB); if (bgra) color_size = GL_BGRA; #ifdef GL_ARB_vertex_type_2_10_10_10_rev glVertexPointer( 4, GL_INT_2_10_10_10_REV, sizeof(verts[0]), 0 ); glColorPointer( color_size, GL_UNSIGNED_INT_2_10_10_10_REV, sizeof(verts[0]), (void *)(sizeof(unsigned int)) ); #endif }