Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Offset problem with OpenGL implementation of Angelcode bitmap font

This topic is 3591 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

I am having a slight problem with my implementation of the Angelcode bitmap font code. I am seeing slight offsets in some of the glyphs. I have an example here: http://www.xiotexstudios.com/xiotex-day-2-on-christmas-windows-textures-and-fonts/ click on the image to get a bigger version. If you look at the window titled 'World map' the 'or' is slightly lower than the 'W' I am more used to coding in DirectX - is this a similar issue to the texel centre problem? The code is here (it's drawn using GL_QUADS):

		fCharX = m_pGlyphPages->m_Glyphs[iChar].m_fX;
		fCharY = m_pGlyphPages->m_Glyphs[iChar].m_fY;
		fWidth = m_pGlyphPages->m_Glyphs[iChar].m_fWidth;
		fHeight = m_pGlyphPages->m_Glyphs[iChar].m_fHeight;
		fOffsetX = m_pGlyphPages->m_Glyphs[iChar].m_fXOffset;
		fOffsetY = m_pGlyphPages->m_Glyphs[iChar].m_fYOffset;
		float fLeft = fCursorX + fOffsetX;
		float fTop = fY + fOffsetY;
		float fRight = fLeft + fWidth;
		float fBottom = fTop + fHeight;
		fCursorX += fKerning;
		// Create the UV's
		fU0 = ((fCharX) / m_pGlyphPages->m_fWidth);
		fU1 = ((fCharX + fWidth) / m_pGlyphPages->m_fWidth);
		fV1 = ((fCharY) / m_pGlyphPages->m_fHeight);
		fV0 = ((fCharY + fHeight) / m_pGlyphPages->m_fHeight);



		fCursorX += m_pGlyphPages->m_Glyphs[iChar].m_fAdvance;

Any ideas?

Share this post

Link to post
Share on other sites
Found the problem - there is a bug in the latest version of the Bitmap font generator. I went back to an older version and the problem goes away.

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!