print_gl_get.cpp 571 B

12345678910111213141516171819202122232425262728293031
  1. #include "print_gl_get.h"
  2. #include <cstdio>
  3. IGL_INLINE void igl::print_gl_get(GLenum pname)
  4. {
  5. double dM[16];
  6. int rows = 4;
  7. int cols = 4;
  8. switch(pname)
  9. {
  10. case GL_MODELVIEW_MATRIX:
  11. case GL_PROJECTION_MATRIX:
  12. {
  13. rows = 4;
  14. cols = 4;
  15. glGetDoublev(pname,dM);
  16. for(int i = 0;i<rows;i++)
  17. {
  18. for(int j = 0;j<cols;j++)
  19. {
  20. printf("%lg ",dM[j*rows+i]);
  21. }
  22. printf("\n");
  23. }
  24. break;
  25. }
  26. default:
  27. fprintf(stderr,"ERROR in print_gl_get(), gl enum not recognized.\n");
  28. }
  29. }