glText
glText copied to clipboard
Use of gltDrawText3D function
Hi! I'm struggling on what to use in the last parameter of the function.
Cheers, Solipa
Hey!
Just for context, there's gltDrawText(), which has the following function signature:
It takes a GLTtext object and a model view projection (MVP) matrix.
void gltDrawText(
GLTtext *text,
GLfloat mvp[16]);
Then there is gltDrawText3D() as you're asking about. It has the following function signature:
It is essentially essentially a utility of gltDrawText(). So instead of taking a single MVP matrix. Then it takes a position + scaled, followed by the view and projection matrix.
void gltDrawText3D(
GLTtext *text,
GLfloat x,
GLfloat y,
GLfloat z,
GLfloat scale,
GLfloat view[16],
GLfloat projection[16]);
From the given position and scale, it then creates a model matrix, and multiplies the matrices together, into a single MVP matrix.
You can see the exact code for it here:
https://github.com/vallentin/glText/blob/8200fa70e32acec0a3cd777d404f41ee0c203ca4/gltext.h#L478-L489
So in conclusion, to answer your question directly. The last parameter is the projection matrix, while the second last parameter is the view matrix.
Hope this answered your question. If not or if you have more, then just comment! :)