游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1350|回复: 2

关于创建D3D设备的疑惑

[复制链接]

7

主题

18

帖子

18

积分

新手上路

Rank: 1

积分
18
发表于 2008-5-2 16:02:00 | 显示全部楼层 |阅读模式
我写了个D3D程序,部分代码如下,变量都已经声明

// create a D3D object
        if( NULL == ( pD3D = Direct3DCreate8( D3D_SDK_VERSION ) ) )
        {
                MessageBox( hWnd, "Direct3D Error!", "Unable to init the Direct3D!", MB_ICONERROR );
                return E_FAIL;
        }

        // get the default adapter
        if( FAILED( pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm) ) )
        {
                return E_FAIL;
        }
        // get the window size
        GetWindowRect( hWnd, &rcWindowBounds );
        GetWindowRect( hWnd, &rcWindowClient );
        ZeroMemory( &d3dpp, sizeof(d3dpp) );

        d3dpp.hDeviceWindow                = hWnd;
        d3dpp.BackBufferWidth        = rcWindowClient.right - rcWindowClient.left;
        d3dpp.BackBufferHeight        = rcWindowClient.bottom - rcWindowClient.top;
        d3dpp.BackBufferFormat        = d3ddm.Format;
        d3dpp.BackBufferCount        = 1;
        d3dpp.SwapEffect                = D3DSWAPEFFECT_FLIP;
        d3dpp.MultiSampleType        = D3DMULTISAMPLE_NONE;
        d3dpp.EnableAutoDepthStencil        = D3DFMT_D16;
        d3dpp.Windowed                        = TRUE;


        // create the device object
        hReturn = pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
                                                                        hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                                                                        &d3dpp, &pD3dDevice );

但是,在调用pD3D->CreateDevice函数时,却发生了错误,我的版本是8.0的,返回值是        hReturn = -2005530516

7

主题

18

帖子

18

积分

新手上路

Rank: 1

积分
18
 楼主| 发表于 2008-5-2 16:04:00 | 显示全部楼层

Re:关于创建D3D设备的疑惑

这是个无效调用吧,请问各位高手,这个错误原因大概是什么呢?有什么解决方法呢?

7

主题

18

帖子

18

积分

新手上路

Rank: 1

积分
18
 楼主| 发表于 2008-5-2 16:28:00 | 显示全部楼层

Re:关于创建D3D设备的疑惑

解决了,谢谢各位哈!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-22 16:18

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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