I’m trying to create a library of costume fonts. The issue I’m having is that when text objects are meant to be drawn in a list it refuses to work. Instead, only 1 letter is drawn where I want and the rest are drawn at the origin. I had a feeling this something to do with glLoadIdentity(); so I placed it out side my loop which draws the objects.
Frustratingly, this didn’t work. It also didn’t work when I heard glLoadIdentity(); in the loop were it was drawn after every object.
I have a feelig my issues has something to do with my matrix can you help? I just need to draw objects in a list.
#include "DrawText.h"
std::vector <CLetter *> qva_Fonts;
void CFonts::DrawText(char *s, GLfloat gfText_PosX, GLfloat gfText_PosY, GLfloat gfFont_Size, GLfloat gfFont_Spacing)
{
//for loop drawing each letter
for (int letter = 0;letter != strlen(s);letter++)
{
//draw font in array
qva_Fonts[((int)*s)- 32]-> draw();
s++;
//loadmatrix Position & Scalling
gfaaSca[0] = gfFont_Size;
gfaaSca[5] = gfFont_Size;
gfaaSca[10] = gfFont_Size;
gfaaSca[15] = gfFont_Size;
gfText_PosX += gfFont_Spacing;
gfaaPos[12] = gfText_PosX;
gfaaPos[13] = gfText_PosY;
//multiply matrix
glMultMatrixf(gfaaPos);
glMultMatrixf(gfaaSca);
}
glLoadIdentity();
}