print_gl_get.cpp 600 B

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