opengl_learn

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

ogl_vec3f_dot.c (386B)


      1 /*
      2 2018 David DiPaola
      3 licensed under CC0 (public domain, see https://creativecommons.org/publicdomain/zero/1.0/)
      4 */
      5 
      6 #include <GL/glew.h>
      7 
      8 #include "ogl.h"
      9 
     10 void
     11 ogl_vec3f_dot(
     12 	struct ogl_vec3f a, struct ogl_vec3f b,
     13 	GLfloat * out_result
     14 ) {
     15 	/* from Wikipedia (https://en.wikipedia.org/wiki/Dot_product#Algebraic_definition) */
     16 	(*out_result) = (a.x*b.x) + (a.y*b.y) + (a.z*b.z);
     17 }
     18