Direct3D (DirectX 9.0) Code Samples&nbsp














Direct3D (DirectX 9.0) Code Samples 的图1 Direct3D (DirectX 9.0) Code Samples 的图2 Direct3D (DirectX 9.0) Code Samples 的图3
Direct3D (DirectX 9.0) Code Samples 的图4





Creating 2D Sprites with D3DXSprite

This sample demonstrates how to create a animated 2D sprite using D3DXSprite which is hardware accelerated and fully compatible with 3D generated content.


Direct3D (DirectX 9.0) Code Samples 的图5


Direct3D (DirectX 9.0) Code Samples 的图7
Direct3D (DirectX 9.0) Code Samples 的图8 Direct3D (DirectX 9.0) Code Samples 的图9 Direct3D (DirectX 9.0) Code Samples 的图10
















Direct3D (DirectX 9.0) Code Samples 的图11 Direct3D (DirectX 9.0) Code Samples 的图12 Direct3D (DirectX 9.0) Code Samples 的图13
Direct3D (DirectX 9.0) Code Samples 的图14





Simple Effect Using .fx Files

This sample demonstrates how to write and use Effect files (.fx) under DirectX 8.1. The sample Effect is very straightforward. It defines a technique called "TwoPassTextureBlend", which has two separate rendering passes, called "Pass0" and "Pass1". The two passes are then used to basically blend two textures together through the simple addition of the texel data.


Relevant Keywords: D3DXCreateEffectFromFile, GetBufferPointer, SetTexture, SetTechnique, Begin, End, texture, technique, pass, AlphaBlendEnable, Texture, ColorOp, ColorArg1, SelectArg1, Disable, and LPD3DXEFFECT.


Direct3D (DirectX 9.0) Code Samples 的图15


Direct3D (DirectX 9.0) Code Samples 的图17
Direct3D (DirectX 9.0) Code Samples 的图18 Direct3D (DirectX 9.0) Code Samples 的图19 Direct3D (DirectX 9.0) Code Samples 的图20
















Direct3D (DirectX 9.0) Code Samples 的图21 Direct3D (DirectX 9.0) Code Samples 的图22 Direct3D (DirectX 9.0) Code Samples 的图23
Direct3D (DirectX 9.0) Code Samples 的图24





Simple Vertex & Pixel Shader (HLSL/Fx Effect File)

This sample demonstrates how to write simple vertex and pixel shaders using Direct3D's new High-Level Shading Language. The two shaders reside within a Direct3D .fx Effect File and have matching inputs and outputs, which allow them to be used simultaneously on the same piece of geometry.


Relevant Keywords: D3DXCreateEffectFromFile, SetTechnique, SetMatrix, SetTexture, Begin, End, float4x4, texture, sampler, technique, pass, LPD3DXEFFECT, and LPD3DXBUFFER.


Direct3D (DirectX 9.0) Code Samples 的图25


Direct3D (DirectX 9.0) Code Samples 的图27
Direct3D (DirectX 9.0) Code Samples 的图28 Direct3D (DirectX 9.0) Code Samples 的图29 Direct3D (DirectX 9.0) Code Samples 的图30
















Direct3D (DirectX 9.0) Code Samples 的图31 Direct3D (DirectX 9.0) Code Samples 的图32 Direct3D (DirectX 9.0) Code Samples 的图33
Direct3D (DirectX 9.0) Code Samples 的图34





Simple Vertex & Pixel Shader (HLSL)

This sample demonstrates how to write both a simple vertex and pixel shader using Direct3D's HLSL without the help of the .fx Effect File format. The shaders in this sample don't really do anything useful or neat, it's meant to be used as a framework or starting place for experimenting with shaders.


Relevant Keywords: CreateVertexDeclaration, D3DXCompileShaderFromFile, GetBufferPointer, CreateVertexShader, CreatePixelShader, D3DDECL_END, D3DVERTEXELEMENT9, D3DDECLTYPE_FLOAT3, D3DDECLUSAGE_POSITION, D3DDECLTYPE_D3DCOLOR, D3DDECLUSAGE_COLOR, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, SetVertexDeclaration, SetMatrix, SetVertexShader, SetPixelShader, GetConstantByName, GetConstantDesc, LPDIRECT3DVERTEXSHADER9, LPDIRECT3DVERTEXDECLARATION9, LPDIRECT3DPIXELSHADER9, LPD3DXCONSTANTTABLE, LPD3DXBUFFER, D3DXHANDLE, D3DXCONSTANT_DESC, ps_1_1, vs_1_1, POSITION, COLOR0, TEXCOORD0, float2, float3, float4x4, float4, mul, stuct, sampler, tex2d, and return.


Direct3D (DirectX 9.0) Code Samples 的图35


Direct3D (DirectX 9.0) Code Samples 的图37
Direct3D (DirectX 9.0) Code Samples 的图38 Direct3D (DirectX 9.0) Code Samples 的图39 Direct3D (DirectX 9.0) Code Samples 的图40
















Direct3D (DirectX 9.0) Code Samples 的图41 Direct3D (DirectX 9.0) Code Samples 的图42 Direct3D (DirectX 9.0) Code Samples 的图43
Direct3D (DirectX 9.0) Code Samples 的图44





Simple Vertex Shader (vs.2.0)

Demonstrates how to write an assembly-level vertex shader using the vs2.0 instruction set defined in DirectX 9.0.


Relevant Keywords: CreateVertexDeclaration, D3DXAssembleShaderFromFile, CreateVertexShader, LPDIRECT3DVERTEXDECLARATION9, LPDIRECT3DVERTEXSHADER9, D3DVERTEXELEMENT9, ID3DXBuffer, D3DDECLTYPE_FLOAT3, D3DDECLUSAGE_COLOR, D3DDECLUSAGE_POSITION, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECL_END, vs.2.0, dcl_position, dcl_color, m4x4, oPos, oD0, and mov.


Direct3D (DirectX 9.0) Code Samples 的图45


Direct3D (DirectX 9.0) Code Samples 的图47
Direct3D (DirectX 9.0) Code Samples 的图48 Direct3D (DirectX 9.0) Code Samples 的图49 Direct3D (DirectX 9.0) Code Samples 的图50
登录后免费查看全文
立即登录
App下载
技术邻APP
工程师必备
  • 项目客服
  • 培训客服
  • 平台客服

TOP