glm::mat4 projection(0); glm::mat4 projectionInv(0); //the frustum in normalized coordinates vector<glm::vec4> NDCCube; NDCCube.push_back(glm::vec4(-1.0f, -1.0f, -1.0f, 1.0f)); NDCCube.push_back(glm::vec4(1.0f, -1.0f, -1.0f, 1.0f)); NDCCube.push_back(glm::vec4(1.0f, -1.0f, 1.0f, -0.0f)); NDCCube.push_back(glm::vec4(-1.0f, -1.0f, 1.0f, -0.0f)); NDCCube.push_back(glm::vec4(-1.0f, 1.0f, -1.0f, 1.0f)); NDCCube.push_back(glm::vec4(1.0f, 1.0f, -1.0f, 1.0f)); NDCCube.push_back(glm::vec4(1.0f, 1.0f, 1.0f, -0.0f)); NDCCube.push_back(glm::vec4(-1.0f, 1.0f, 1.0f, -0.0f)); /* Get the current PROJECTION from OpenGL */ glGetFloatv(GL_PROJECTION_MATRIX, (GLfloat*)(glm::value_ptr(projection))); //calculate the inverse of projection matrix. Hopefully, this'll get us the frustum when multiplied //by coords of a cube. projectionInv = glm::inverse(projection); //push back vertices for(int i = 0; i < 8; i++) { glm::vec4 tempvec; tempvec = projectionInv * NDCCube.at(i); //multiply by projection matrix inverse to obtain frustum vertex frustumVertices.push_back(Vector3(tempvec.x, tempvec.y, tempvec.z)); }

**Edited by Naked Shooter, 21 October 2012 - 04:16 PM.**