• Advertisement
Sign in to follow this  

fonts masking?

This topic is 4263 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

well i am trying to mask fonts so it will blend with the background.. this is the code so far: GLvoid Graphics::BuildFont(GLvoid) { float cx; float cy; base=glGenLists(256); glBindTexture(GL_TEXTURE_2D, texture[29]); for (int loop=0; loop<256; loop++) { cx=float(loop%16)/16.0f; cy=float(loop/16)/16.0f; glNewList(base+loop,GL_COMPILE); glBegin(GL_QUADS); glTexCoord2f(cx,1-cy-0.0625f); glVertex2i(0,0); glTexCoord2f(cx+0.0625f,1-cy-0.0625f); glVertex2i(16,0); glTexCoord2f(cx+0.0625f,1-cy); glVertex2i(16,16); glTexCoord2f(cx,1-cy); glVertex2i(0,16); glEnd(); glTranslated(10,0,0); glEndList(); } } GLvoid Graphics::DestroyFont(GLvoid) { glDeleteLists(base,256); } GLvoid Graphics::glPrint(GLfloat x, GLfloat y, GLfloat z, char *string) { int set=0; glDisable(GL_DEPTH_TEST); glDisable(GL_BLEND); glEnable(GL_BLEND); glBlendFunc(GL_DST_COLOR,GL_ZERO); glBindTexture(GL_TEXTURE_2D, texture[29]); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glRasterPos2f(-0.45f+0.05f, 0.32f); glTranslatef(x,y,z); //-89 glOrtho(0,640,0,480,-1,1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glRasterPos2f(-0.45f+0.05f, 0.32f); glTranslatef(x,y,z); //-89 glListBase(base-32+(128*set)); glCallLists(strlen(string),GL_UNSIGNED_BYTE,string); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glEnable(GL_DEPTH_TEST); glBindTexture(GL_TEXTURE_2D, texture[30]); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glRasterPos2f(-0.45f+0.05f, 0.32f); glTranslatef(x,y,z); glOrtho(0,640,0,480,-1,1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glRasterPos2f(-0.45f+0.05f, 0.32f); glTranslatef(x,y,z); glListBase(base-32+(128*set)); glCallLists(strlen(string),GL_UNSIGNED_BYTE,string); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glEnable(GL_DEPTH_TEST); } and the problem is that its not blending very well for example look at this picture: wha.JPG i was trying to write "net" but the first letter is going on the second one and the second on the third.. BTW. the red and white thingy is the application background.. what can i do? btw this are the textures (29): Font.bmp and the mask texture (30): Font2.bmp its very wierd.. because u can see the background but its going on the letter.. very wierd :/ please help me out (for some reason the tags aint working.. so heres the code: http://rafb.net/paste/results/CgDlNh92.html ) [Edited by - clearly on June 24, 2006 3:23:36 PM]

Share this post


Link to post
Share on other sites
Advertisement
glEnable(GL_DEPTH_TEST) on line 63 should be glDisable(GL_DEPTH_TEST).
(I got the line number from http://rafb.net/paste/results/CgDlNh92.html)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement