二、 细节变化
1、函数参数变化:
SetIndices少了参数BaseVertexIndex,,加到DrawIndexedPrimitive了。
DrawIndexedPrimitive增加第二个参数BaseVertexIndex,第一个顶点相对于顶点缓冲首地址的偏移数
CreateTexture
CreateVolumeTexture
CreateCubeTexture
CreateVertexBuffer
CreateIndexBuffer
CreateRenderTarget
CreateDepthStencilSurfac
GetBackBuffer
GetDisplayMode增加第一个参数iSwapChain,交换链
SetStreamSource增加了第三个参数OffsetInBytes
GetGammaRamp
SetGammaRamp
GetAdapterModeCount
EnumAdapterModes增加第二参数D3DFORMART
GetAdapterIdentifier:第二参数默认值改变,宏正好相反
D8:GetAdapterIdentifier(D3DADAPTER_DEFAULT, D3DENUM_NO_WHQL_LEVEL , &identifier)=
D9:GetAdapterIdentifier(D3DADAPTER_DEFAULT,0 ,&identifier)
D8:GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0 , &identifier)=
D9:GetAdapterIdentifier(D3DADAPTER_DEFAULT,D3DENUM_WHQL_LEVEL ,&identifier)
CheckDeviceType
GetDeviceCaps模式有所变化,具体见SDK,举例如下:
//CheckDeviceType函数区别,
#ifdef D3DX8
#endif
#ifdef D3DX9
#endif
#ifdef D3DX8
#endif
#ifdef D3DX9
#endif
CheckDeviceMultiSampleTy
SetRenderTarget:
SetRenderTarget(pRenderTarget,pNewZStencil) →功能分割成两个函数
SetRenderTarget(RenderTargetIndex,pRenderTarget)
SetDepthStencilSurface(pNewZStencil)
GetRenderTarget多了个参数RenderTargetIndex
D3DXAssembleShader 参数增加pDefines,顺序也变了,具体见SDK
2、函数名字改变,同样的功能变更到其他函数中:D8→D9
CreateImageSurface→
CreateOffscreenPlainSurf
SetRenderState(D3DRS_SOFTWAREVERTEXPROCESSING
SetSoftwareVertexProcess
SetTextureStageState(一些参数,
SetSamplerState(参数,
参数:
D3DTSS_ADDRESSU D3DTSS_ADDRESSV D3DTSS_ADDRESSW D3DTSS_BORDERCOLOR
D3DTSS_MAGFILTER D3DTSS_MINFILTER D3DTSS_MIPFILTER
D3DTSS_MIPMAPLODBIAS
D3DSAMP_前缀的
D3DSAMP_ADDRESSU = 1,
D3DSAMP_ADDRESSV = 2,
D3DSAMP_ADDRESSW = 3,
D3DSAMP_BORDERCOLOR = 4,
D3DSAMP_MAGFILTER = 5,
D3DSAMP_MINFILTER = 6,
D3DSAMP_MIPFILTER = 7,
D3DSAMP_MIPMAPLODBIAS = 8,
D3DSAMP_MAXMIPLEVEL = 9,
D3DSAMP_MAXANISOTROPY = 10,
D3DSAMP_SRGBTEXTURE = 11,
D3DSAMP_ELEMENTINDEX = 12, 原来没有
D3DSAMP_DMAPOFFSET = 13,
D3DSAMP_FORCE_DWORD = 0x7fffffff,
SetVertexShader→
①固定管线FIXED-FUNCTION PIPELINE ,SetFVF
②着色器VertexShader,SetVertexShader
Remark:D9要使用SHADER必须先调用SetVertexDeclaration 再调用SetVertexShader
所以得先通过CreateVertexDeclaration()创建个IDirect3DVertexDeclarati
例如:
VertexElement = {0 , 0 ,D3DDECLTYPE_FLOAT3 , D3DDECLMETHOD_DEFAULT ,D3DDECLUSAGE_POSITION , 0};
CreateVertexDeclaration(VertexElement,&VertexDeclaration);
SetVertexShaderConstant→
SetVertexShaderConstantF
ResourceManagerDiscardBy
EvictManagedResources
3、属性,结构改变:
D3DPRESENT_PARAMETERS结构变化如下:
d3dpp.FullScreen_PresentationInterval→
d3dpp.PresentationInterval
GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&d3ddm)
d3dpp.BackBufferFormat = d3ddm.Format →
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN
D3DRENDERSTATETYPE结构变动挺多,具体SDK吧:举个例子
D3DRS_ZBIAS → D3DRS_DEPTHBIAS
D3DTEXTUREFILTERTYPE变动了一些
D3DTEXF_GAUSSIANCUBIC →
D3DTEXF_GAUSSIANQUAD