RubenRS

Members
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About RubenRS

  • Rank
    Newbie

Personal Information

  • Interests
    Programming
  1. 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.
  2. How do i open an image to use it as Texture2D information without D3DX11CreateShaderResourceViewFromFile? And how it works for different formats like (JPG, PNG, BMP, DDS, etc.)? I have an (512 x 512) image with font letters, also i have the position and texcoord of every letter. The main idea is that i want to obtain the image pixel info, use the position and texcoords to create a new texture with one letter and render it. Or am I wrong in something?
  3. I want to render true type fonts in DirectX11, right now in one program im using stb_truetype.h to get the position and texcoords from every character i want. And in other one, i have DirectX11 with a texture that i can fill it with some information, in this case the .ttf info. But how do i need to open the .tff to tell the texture something like: "Hey, these are the coordinates you need, copy that pixels and fill yourself"?