blackLightG

Member
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

110 Neutral

About blackLightG

  • Rank
    Newbie
  1. smasherprog's idea of using D3DX10_SPRITE_SAVE_STATE worked but now it appears to ignore the z-buffer test. I used [source lang="cpp"]ID3DX10Sprite *ppSprite; D3DX10CreateSprite(g_pd3dDevice, 512, &ppSprite); ppSprite->Begin(D3DX10_SPRITE_SAVE_STATE); // text rendering ppSprite->End();[/source] I'm just going to reset the depth-buffer. I found a useful article here: http://hide1713.wordpress.com/2009/07/06/directx-10-drawtext-disable-depth-buffer-heres-how-to-fix-it/
  2. There are no textures used here, the cubes have vertex colours which are interpolated in the shader
  3. The actual loop: [source lang="cpp"]renderer.beginRender(); //text.render(); for(int i = 0; i < 10; ++i) { cube[i].update(t, D3DXVECTOR3(0, i * 2, i * 3), D3DXVECTOR3(0, 1, 0), D3DXVECTOR3(1, 1, 1)); mat.setWorldViewProjection(cube[i].getWorld(), cam.getView(), cam.getProjection()); cube[i].render(renderer.g_pd3dDevice, mat.getTechnique()); } renderer.endRender();[/source]
  4. Actually they are cubes. I update the transform matrix, set the effect file variables and then I draw the cubes. This is done in a loop. [source lang="cpp"]D3DXMatrixTranslation( &g_World, translate.x, translate.y, translate.z ); . . . g_pWorldVariable->SetMatrix( g_World ); g_pViewVariable->SetMatrix( g_View ); g_pProjectionVariable->SetMatrix( g_Projection ); . . . D3D10_TECHNIQUE_DESC techDesc; g_pTechnique->GetDesc( &techDesc ); for( UINT p = 0; p < techDesc.Passes; ++p ) { g_pTechnique->GetPassByIndex( p )->Apply( 0 ); g_pd3dDevice->DrawIndexed( 36, 0, 0 ); // 36 vertices needed for 12 triangles in a triangle list }[/source]
  5. I have been trying to add text to my application using ID3DX10Font and D3DX10CreateFont but every time I say DrawText my other geometry stops rendering correctly. I have attached images of output window with text and with text disabled. I use this code to initialize: [source lang="cpp"]g_pFont = nullptr; HRESULT hr = D3DX10CreateFont(g_pd3dDevice, 35, // the font height 0, // the font width FW_BOLD, // the weight of the font 1, // number of mip levels FALSE, // this is not an italic font DEFAULT_CHARSET, // default character set OUT_DEFAULT_PRECIS, // default size mapping DEFAULT_QUALITY, // default quality mapping DEFAULT_PITCH | FF_DONTCARE, // default pitch L"Helvetica", // use Helvetica as the basis for this font &g_pFont); // the output // make sure the font was created correctly if (FAILED(hr)) { return hr; } return S_OK;[/source] and to draw: [source lang="cpp"]HRESULT hr = g_pFont->DrawText( NULL, TEXT("This is a test string"), -1, &rc, DT_LEFT, D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );[/source] Any help appreciated.