actboy168 / direct3d8to9 Goto Github PK
View Code? Open in Web Editor NEWThis is convertor of Direct3D8 to Direct3D9 rendering functions
License: MIT License
This is convertor of Direct3D8 to Direct3D9 rendering functions
License: MIT License
在写魔兽后台截图, 发现在ydwe 1.24 以d3d9的模式进游戏 截出来的是全黑的图片 width height信息是正确的
下面这段代码在1.24 dx8的情况下是正常的 疑似 8to9之后 CopyRects 没有正确的把后台缓冲区复制到贴图里。
typedef void(__stdcall* OnCaputeFinish)(const void* buffer, int w, int h);
long OutputDx8Buffer(IDirect3DDevice8* device, OnCaputeFinish callback)
{
IDirect3DSurface8* surface = nullptr;
HRESULT hr = device->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &surface);
if (FAILED(hr)) return hr;
D3DSURFACE_DESC surface_desc;
hr = surface->GetDesc(&surface_desc);
if (FAILED(hr)) return hr;
IDirect3DTexture8* texture = nullptr;
IDirect3DSurface8* tex_surface;
hr = device->CreateTexture(surface_desc.Width,
surface_desc.Height,
1,
0,
surface_desc.Format,
D3DPOOL_SYSTEMMEM, //必须为这个
&texture);
if (hr < 0) {
return hr;
}
hr = texture->GetSurfaceLevel(0, &tex_surface);
if (hr < 0)return hr;
hr = device->CopyRects(surface, NULL, 0, tex_surface, NULL);
D3DLOCKED_RECT d3drc;
texture->LockRect(0, &d3drc, NULL, D3DLOCK_READONLY);
/*取像素*/
d3drc.Pitch >>= 2;
if (callback)
{
callback(d3drc.pBits, surface_desc.Width, surface_desc.Height);
}
texture->UnlockRect(0);
tex_surface->Release();
texture->Release();
surface->Release();
return hr;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.