opengl_learn

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

ogl_mat4f_scale.c (692B)


      1 /*
      2 2018 David DiPaola
      3 licensed under CC0 (public domain, see https://creativecommons.org/publicdomain/zero/1.0/)
      4 */
      5 
      6 #include "ogl.h"
      7 
      8 void
      9 ogl_mat4f_scale(
     10 	struct ogl_mat4f matrix, struct ogl_vec3f scale,
     11 	struct ogl_mat4f * out_result
     12 ) {
     13 	/* see OpenGL 2.1 glScale(): https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glScale.xml */
     14 	/* note: glScale() was deprecated, then removed from later OpenGL versions. don't use it */
     15 
     16 	struct ogl_mat4f scale_matrix = { .values = {
     17 		scale.x, 0.0f,    0.0f,    0.0f,
     18 		0.0f,    scale.y, 0.0f,    0.0f,
     19 		0.0f,    0.0f,    scale.z, 0.0f,
     20 		0.0f,    0.0f,    0.0f,    1.0f,
     21 	}};
     22 	ogl_mat4f_multiply(matrix, scale_matrix, out_result);
     23 }
     24