I'm trying to render the characters of a bitmap texture that i generated with stb_truetype.h.
Currently i have the texcoords and the longitude of each character, my DirectXTexture2D is 512x512 normilized from -1 to 1.
So, i send to render the character "C", creating my triangulation starting from coords (0,0) -> (X0,Y0).
Then i get my X1 adding X0 + longitude. NOTE: I transformed my longitude to screen space coordinates dividing out of 512 (texture width size) before.
This is my bitmap texture:
This is my vertex buffer:
float sizeX = static_cast<float>(tempInfo.longitude) / 512;
float sizeY = 0.0625f; //32/512 (32->height of font)
spritePtr[0].Pos = XMFLOAT3(0.0f + sizeX, 0.0f + sizeY, 1.0f);
spritePtr[1].Pos = XMFLOAT3(0.0f + sizeX, 0.0f, 1.0f);
spritePtr[2].Pos = XMFLOAT3(0.0f, 0.0f, 1.0f);
spritePtr[3].Pos = XMFLOAT3(0.0f, 0.0f, 1.0f);
spritePtr[4].Pos = XMFLOAT3(0.0f, 0.0f + sizeY, 1.0f);
spritePtr[5].Pos = XMFLOAT3(0.0f + sizeX, 0.0f + sizeY, 1.0f);
spritePtr[0].Tex = XMFLOAT2(tempInfo.Tex_u1, tempInfo.Tex_v0);
spritePtr[1].Tex = XMFLOAT2(tempInfo.Tex_u1, tempInfo.Tex_v1);
spritePtr[2].Tex = XMFLOAT2(tempInfo.Tex_u0, tempInfo.Tex_v1);
spritePtr[3].Tex = XMFLOAT2(tempInfo.Tex_u0, tempInfo.Tex_v1);
spritePtr[4].Tex = XMFLOAT2(tempInfo.Tex_u0, tempInfo.Tex_v0);
spritePtr[5].Tex = XMFLOAT2(tempInfo.Tex_u1, tempInfo.Tex_v0);
NOTE: spritePtr is the pointer to my dynamic buffer that i map and unmap.
And this is my result:
I don't understand why it is too small compared to my bitmap and if i expand the triangulation i get a pixelated character.
↧