title: Creating and using AABB for collision detection 3d (OpenGL)
body: <p>Suppose I have a square that I have created in the following way:</p>
  
  <pre><code>glBegin(GL_QUADS);
  glColor3f(0.0f,1.0f,0.0f);  
  glVertex3f( 1.0f, 1.0f,-1.0f);  
  glVertex3f(-1.0f, 1.0f,-1.0f);  
  glVertex3f(-1.0f, 1.0f, 1.0f);  
  glVertex3f( 1.0f, 1.0f, 1.0f);  
  
  glColor3f(1.0f,0.5f,0.0f);  
  glVertex3f( 1.0f,-1.0f, 1.0f);  
  glVertex3f(-1.0f,-1.0f, 1.0f);  
  glVertex3f(-1.0f,-1.0f,-1.0f);  
  glVertex3f( 1.0f,-1.0f,-1.0f);  
  
  glColor3f(1.0f,1.0f,0.0f);  
  glVertex3f( 1.0f,-1.0f,-1.0f);  
  glVertex3f(-1.0f,-1.0f,-1.0f);  
  glVertex3f(-1.0f, 1.0f,-1.0f);  
  glVertex3f( 1.0f, 1.0f,-1.0f);  
  
  glColor3f(0.0f,0.0f,1.0f);  
  glVertex3f(-1.0f, 1.0f, 1.0f);  
  glVertex3f(-1.0f, 1.0f,-1.0f);  
  glVertex3f(-1.0f,-1.0f,-1.0f);  
  glVertex3f(-1.0f,-1.0f, 1.0f);  
  
  glColor3f(1.0f,0.0f,1.0f);  
  glVertex3f( 1.0f, 1.0f,-1.0f);  
  glVertex3f( 1.0f, 1.0f, 1.0f);  
  glVertex3f( 1.0f,-1.0f, 1.0f);  
  glVertex3f( 1.0f,-1.0f,-1.0f);  
  glEnd();    
  </code></pre>
  
  <p>Now suppose I want to use an AABB structure to detect when a sphere collides with the sides of this cube (not the top nor the bottom of the cube) and thus prevent it from going through the cube? Any ideas on how to go about doing this?</p>
  
  <p>Also would I be able to use the AABB structure if I had implemented the cube using glutSolidCube?</p>
  
  <p>Also is there an easier of detecting collision without having to use AABB? Maybe like testing for intersection or something like that?</p>