Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*3d text rendering - text.cpp*/
- #include "text.h"
- void text::drawText(vector3d pos,vector3d rot,const char* tex)
- {
- glPushMatrix();
- glTranslatef(pos.x,pos.y,pos.z);
- glRotatef(rot.x,1,0,0);
- glRotatef(rot.y,0,1,0);
- glRotatef(rot.z,0,0,1);
- int g=0;
- for(int i=0;i<strlen(tex);i++)
- {
- if(tex[i]=='\n')
- {
- glTranslatef(-g*width,-height,0);
- g=0;
- continue;
- }
- g++;
- glCallList(characters.at((int)tex[i]-65));
- glTranslatef(width,0,0);
- }
- glPopMatrix();
- }
- text::text(float w,float h,std::vector<unsigned int>& ch)
- {
- width=w;
- height=h;
- characters=ch;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement