bug in CD3DFont ???

bug in CD3DFont ???

Post by SkullOn » Fri, 18 Jan 2002 18:31:23

ok i'm looking at the DrawTextScaled function and it uses GetViewport to get
the viewport
dimensions. The problem is i believe GetViewport isn't available when you
are in
pure HW VP mode and the function doesn't check the return code on
Am i missing someting here?

SkullOne - Hero Interactive

// Name: DrawTextScaled()
// Desc: Draws scaled 2D text.  Note that x and y are in viewport
//       (ranging from -1 to +1).  fXScale and fYScale are the size fraction
//       relative to the entire viewport.  For example, a fXScale of 0.25 is
//       1/8th of the screen width.  This allows you to output text at a
//       fraction of the viewport, even if the screen or window size
HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
                                  FLOAT fXScale, FLOAT fYScale, DWORD
                                  TCHAR* strText, DWORD dwFlags )
    if( m_pd3dDevice == NULL )
        return E_FAIL;

    // Set up renderstate
    m_pd3dDevice->CaptureStateBlock( m_dwSavedStateBlock );
    m_pd3dDevice->ApplyStateBlock( m_dwDrawTextStateBlock );
    m_pd3dDevice->SetVertexShader( D3DFVF_FONT2DVERTEX );
    m_pd3dDevice->SetPixelShader( NULL );
    m_pd3dDevice->SetStreamSource( 0, m_pVB, sizeof(FONT2DVERTEX) );

    // Set filter states
    if( dwFlags & D3DFONT_FILTERED )
        m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER,
        m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER,

    D3DVIEWPORT8 vp;
m_pd3dDevice->GetViewport( &vp );

    FLOAT sx  = (x+1.0f)*vp.Width/2;
    FLOAT sy  = (y+1.0f)*vp.Height/


1. Bugs, bugs, bugs, bugs

What is this?
A Update to Vers. 5.5 with multithreading BUGS.
Is it normal that I must wait for a patch to
terminate this BUG.
I'm a real lightwave fan but if I pay
a lot of money for an update it should be
errorfree or should I change over to 3DSMAX or

2. Will ScanJet IIc work with 220V?

3. CD3DFont and ID3DXFont

4. what printer should i buy?

5. CD3DFont question

6. about images in vb40 32bits

7. Large Fonts and CD3DFont and texture limits

8. cd3dfont, and uninstalled font

9. Pixel debris when using Large CD3DFont

10. After drawing text using CD3DFont class, images are not rendering

11. question about cd3dfont (smooth the edges)

12. Stratavision 3d 5.0 bugs bugs bugs