资源简介
D3D三层Texture纹理经像素着色器实现渲染YUV420P全工程源码,VS2013编译通过。修正了画质问题。运行前确保安装了DirectX9.
代码片段和文件信息
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// File: d3dUtility.cpp
//
// Author: Frank Luna (C) All Rights Reserved
//
// System: AMD Athlon 1800+ XP 512 DDR Geforce 3 Windows XP MSVC++ 7.0
//
// Desc: Provides utility functions for simplifying common tasks.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
#include “d3dUtility.h“
// vertex formats
const DWORD d3d::Vertex::FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1;
bool d3d::InitD3D(
HINSTANCE hInstance
int width int height
bool windowed
D3DDEVTYPE deviceType
IDirect3DDevice9** device)
{
//
// Create the main application window.
//
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)d3d::WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(0 IDI_APPLICATION);
wc.hCursor = LoadCursor(0 IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockobject(WHITE_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = “Direct3D9App“;
if( !RegisterClass(&wc) )
{
::MessageBox(0 “RegisterClass() - FAILED“ 0 0);
return false;
}
HWND hwnd = 0;
hwnd = ::CreateWindow(“Direct3D9App“ “Direct3D9App“
WS_EX_TOPMOST
0 0 width height
0 /*parent hwnd*/ 0 /* menu */ hInstance 0 /*extra*/);
if( !hwnd )
{
::MessageBox(0 “CreateWindow() - FAILED“ 0 0);
return false;
}
::ShowWindow(hwnd SW_SHOW);
::UpdateWindow(hwnd);
//
// Init D3D:
//
HRESULT hr = 0;
// Step 1: Create the IDirect3D9 object.
IDirect3D9* d3d9 = 0;
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
if( !d3d9 )
{
::MessageBox(0 “Direct3DCreate9() - FAILED“ 0 0);
return false;
}
// Step 2: Check for hardware vp.
D3DCAPS9 caps;
d3d9->GetDeviceCaps(D3DADAPTER_DEFAULT deviceType &caps);
int vp = 0;
if( caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
vp = D3DCREATE_HARDWARE_VERTEXPROCESSING;
else
vp = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
// Step 3: Fill out the D3DPRESENT_PARAMETERS structure.
D3DDISPLAYMODE d3ddm;
UINT adapter = D3DADAPTER_DEFAULT;
IDirect3D9_GetAdapterDisplayMode(d3d9 adapter &d3ddm);
// 默认不使用多采样
D3DMULTISAMPLE_TYPE multiType = D3DMULTISAMPLE_NONE;
if(d3d9->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT
D3DDEVTYPE_HAL D3DFMT_A8R8G8B8 !windowed
D3DMULTISAMPLE_4_SAMPLES
NULL) == D3D_OK)
{
// 保存多采样类型
multiType = D3DMULTISAMPLE_4_SAMPLES;
}
D3DPRESENT_PARAMETERS d3dpp;
d3dpp.BackBufferWidth = width;
d3dpp.BackBufferHeight = height;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
d3dpp.BackBufferCount = 1;
d3dpp.MultiSampleType = multiType;
d3dpp.MultiSampleQuality = 0;
d3dpp.SwapEffect = D3DSWAPEFFE
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-12-13 22:25 MultiTexture\
目录 0 2016-12-13 22:25 MultiTexture\Backup\
文件 902 2016-11-29 16:20 MultiTexture\Backup\MultiTexture.sln
目录 0 2016-12-13 22:25 MultiTexture\Debug\
文件 89600 2016-12-13 22:25 MultiTexture\Debug\MultiTexture.exe
文件 585420 2016-12-13 22:25 MultiTexture\Debug\MultiTexture.ilk
文件 1314816 2016-12-13 22:25 MultiTexture\Debug\MultiTexture.pdb
文件 1892184 2009-09-04 17:29 MultiTexture\Debug\d3dx9_42.dll
文件 495 2016-12-02 23:15 MultiTexture\Debug\ps_multitex.txt
目录 0 2016-12-13 22:25 MultiTexture\MultiTexture\
目录 0 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\
文件 7696 2016-11-30 17:39 MultiTexture\MultiTexture\Debug\BuildLog.htm
文件 1174 2016-12-05 20:17 MultiTexture\MultiTexture\Debug\MultiTexture.Build.CppClean.log
文件 1826 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\MultiTexture.log
目录 0 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\MultiTexture.tlog\
文件 61726 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\MultiTexture.tlog\CL.read.1.tlog
文件 1308 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\MultiTexture.tlog\CL.write.1.tlog
文件 156 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\MultiTexture.tlog\MultiTexture.lastbuildstate
文件 1250 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\MultiTexture.tlog\cl.command.1.tlog
文件 1364 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\MultiTexture.tlog\li
文件 3028 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\MultiTexture.tlog\li
文件 518 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\MultiTexture.tlog\li
文件 198778 2016-12-05 20:17 MultiTexture\MultiTexture\Debug\d3dUtility.obj
文件 67 2016-11-30 17:39 MultiTexture\MultiTexture\Debug\mt.dep
文件 191514 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\ps_multitex.obj
文件 1010688 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\vc120.idb
文件 684032 2016-12-13 22:25 MultiTexture\MultiTexture\Debug\vc120.pdb
文件 4232 2016-11-29 16:25 MultiTexture\MultiTexture\MultiTexture.vcproj
文件 1419 2016-11-30 17:40 MultiTexture\MultiTexture\MultiTexture.vcproj.DQ-DEV32-PC.DQ-DEV32.user
文件 5078 2016-12-03 22:00 MultiTexture\MultiTexture\MultiTexture.vcxproj
文件 1170 2016-12-03 22:00 MultiTexture\MultiTexture\MultiTexture.vcxproj.filters
............此处省略171个文件信息
- 上一篇:ffmpeg实现dxva2硬件加速
- 下一篇:OpenCL双边滤波实现美颜功能
评论
共有 条评论