opengl_learn

step-by-step introduction to OpenGL
git clone https://0xdd.org/code/opengl_learn.git
Log | Files | Refs | README | LICENSE

ogl_mat4f_print.c (735B)


      1 /*
      2 2018 David DiPaola
      3 licensed under CC0 (public domain, see https://creativecommons.org/publicdomain/zero/1.0/)
      4 */
      5 
      6 #include <stdio.h>
      7 
      8 #include "ogl.h"
      9 
     10 void
     11 ogl_mat4f_print(
     12 	struct ogl_mat4f matrix, const char * line_prefix, const char * line_suffix
     13 ) {
     14 	line_prefix = (line_prefix == NULL) ? "" : line_prefix;
     15 	line_suffix = (line_suffix == NULL) ? "" : line_suffix;
     16 
     17 	printf("%s" "{" "%s" "\n", line_prefix, line_suffix);
     18 	for (int i=0; i<16; i++) {
     19 		if ((i%4) == 0) {
     20 			printf("%s" "\t", line_prefix);
     21 		}
     22 		//printf("%8g" "f, ", matrix.values[i]);
     23 		ogl_GLfloat_print(matrix.values[i]);
     24 		printf(", ");
     25 		if ((i%4) == 3) {
     26 			printf("%s" "\n", line_suffix);
     27 		}
     28 	}
     29 	printf("%s" "}" "%s" "\n", line_prefix, line_suffix);
     30 
     31 }
     32 
     33