游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1642|回复: 0

请教关于使用D3DXCreateText创建3D字体的问题

[复制链接]

2

主题

2

帖子

0

积分

新手上路

Rank: 1

积分
0
发表于 2007-5-21 17:09:00 | 显示全部楼层 |阅读模式
我用D3DXCreateText函数创造了一个3D字体的mesh,想要模拟windows自带的哪个3D字体的屏保的效果,程序没报错,运行起来却什么都没有显示,请高人指点。(矩阵变换也设置了)
程序代码:VOID Render()
{
        HDC hdc;
        hdc = CreateCompatibleDC(0);
        HFONT hfont;
        HFONT hfontold;
        hfont = CreateFontIndirect(&lf);
    hfontold = (HFONT)SelectObject(hdc,hfont);
       
    if( NULL == g_pd3dDevice )
        return;

    // Clear the backbuffer to a blue color
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
   
    // Begin the scene
    if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
    {
        D3DXCreateText(g_pd3dDevice, hdc,"Dai Bi Dai Si", 0.01f
                        ,0.4f,&text,0,0);
                text->DrawSubset(0);
                // Rendering of scene objects can happen here
   
        // End the scene
        g_pd3dDevice->EndScene();
    }

    // Present the backbuffer contents to the display
    g_pd3dDevice-&gtresent( NULL, NULL, NULL, NULL );
}
lf是我定义的一个LOGFONT
VOID SetupMatrices()
{
   
    UINT  iTime  = timeGetTime() % 1000;
    FLOAT fAngle = iTime * (2.0f * D3DX_PI) / 1000.0f;
    D3DXMatrixRotationY( &matWorld, fAngle );
    g_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );*/

   
    D3DXVECTOR3 vEyePt( 0.0f, 3.0f,-5.0f );
    D3DXVECTOR3 vLookatPt( 0.0f, 0.0f, 0.0f );
    D3DXVECTOR3 vUpVec( 0.0f, 1.0f, 0.0f );
    D3DXMATRIXA16 matView;
    D3DXMatrixLookAtLH( &matView, &vEyePt, &vLookatPt, &vUpVec );
    g_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );

   
    D3DXMATRIXA16 matProj;
    D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f );
    g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-26 09:23

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表