29 #include "vertexBufferBase.h"
30 #include "vertexBufferState.h"
34 void VertexBufferBase::drawBoundingSphere(VertexBufferState& state )
const
36 GLuint displayList = state.getDisplayList( &_boundingSphere );
38 if( displayList == state.INVALID )
40 displayList = state.newDisplayList( &_boundingSphere );
41 glNewList( displayList, GL_COMPILE );
43 const float x = _boundingSphere.x();
44 const float y = _boundingSphere.y();
45 const float z = _boundingSphere.z();
46 const float x1 = x - _boundingSphere.w();
47 const float x2 = x + _boundingSphere.w();
48 const float y1 = y - _boundingSphere.w();
49 const float y2 = y + _boundingSphere.w();
50 const float z1 = z - _boundingSphere.w();
51 const float z2 = z + _boundingSphere.w();
52 const float size = _boundingSphere.w();
56 glNormal3f( 1.0f, 0.0f, 0.0f );
57 glVertex3f( x1, y - size, z - size );
58 glVertex3f( x1, y + size, z - size );
59 glVertex3f( x1, y + size, z + size );
60 glVertex3f( x1, y - size, z + size );
61 glNormal3f( -1.0f, 0.0f, 0.0f );
62 glVertex3f( x2, y - size, z - size );
63 glVertex3f( x2, y - size, z + size );
64 glVertex3f( x2, y + size, z + size );
65 glVertex3f( x2, y + size, z - size );
67 glNormal3f( 0.0f, -1.0f, 0.0f );
68 glVertex3f( x - size, y2, z - size );
69 glVertex3f( x + size, y2, z - size );
70 glVertex3f( x + size, y2, z + size );
71 glVertex3f( x - size, y2, z + size );
72 glNormal3f( 0.0f, 1.0f, 0.0f );
73 glVertex3f( x - size, y1, z - size );
74 glVertex3f( x - size, y1, z + size );
75 glVertex3f( x + size, y1, z + size );
76 glVertex3f( x + size, y1, z - size );
78 glNormal3f( 0.0f, 0.0f, -1.0f );
79 glVertex3f( x - size, y - size, z2 );
80 glVertex3f( x - size, y + size, z2 );
81 glVertex3f( x + size, y + size, z2 );
82 glVertex3f( x + size, y - size, z2 );
83 glNormal3f( 0.0f, 0.0f, 1.0f );
84 glVertex3f( x - size, y - size, z1 );
85 glVertex3f( x + size, y - size, z1 );
86 glVertex3f( x + size, y + size, z1 );
87 glVertex3f( x - size, y + size, z1 );
94 glCallList( displayList );