print_gl_get.cpp 946 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #include "print_gl_get.h"
  9. #ifndef IGL_NO_OPENGL
  10. #include <cstdio>
  11. IGL_INLINE void igl::print_gl_get(GLenum pname)
  12. {
  13. double dM[16];
  14. int rows = 4;
  15. int cols = 4;
  16. switch(pname)
  17. {
  18. case GL_MODELVIEW_MATRIX:
  19. case GL_PROJECTION_MATRIX:
  20. {
  21. rows = 4;
  22. cols = 4;
  23. glGetDoublev(pname,dM);
  24. for(int i = 0;i<rows;i++)
  25. {
  26. for(int j = 0;j<cols;j++)
  27. {
  28. printf("%lg ",dM[j*rows+i]);
  29. }
  30. printf("\n");
  31. }
  32. break;
  33. }
  34. default:
  35. fprintf(stderr,"ERROR in print_gl_get(), gl enum not recognized.\n");
  36. }
  37. }
  38. #endif