print_gl_get.cpp 926 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. #include <cstdio>
  10. IGL_INLINE void igl::opengl2::print_gl_get(GLenum pname)
  11. {
  12. double dM[16];
  13. int rows = 4;
  14. int cols = 4;
  15. switch(pname)
  16. {
  17. case GL_MODELVIEW_MATRIX:
  18. case GL_PROJECTION_MATRIX:
  19. {
  20. rows = 4;
  21. cols = 4;
  22. glGetDoublev(pname,dM);
  23. for(int i = 0;i<rows;i++)
  24. {
  25. for(int j = 0;j<cols;j++)
  26. {
  27. printf("%lg ",dM[j*rows+i]);
  28. }
  29. printf("\n");
  30. }
  31. break;
  32. }
  33. default:
  34. fprintf(stderr,"ERROR in print_gl_get(), gl enum not recognized.\n");
  35. }
  36. }