DirectX 11比例纹理2d
directX 11 scale texture2D
我想缩放我从aceareRenextFrame创建的纹理。这是我的代码:
if (gRealTexture == nullptr) {
D3D11_TEXTURE2D_DESC description;
texture2D->GetDesc(&description);
description.BindFlags = 0;
description.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
description.Usage = D3D11_USAGE_STAGING;
description.MiscFlags = 0;
hr = gDevice->CreateTexture2D(&description, NULL, &gRealTexture);
if (FAILED(hr)) {
if (gRealTexture) {
gRealTexture->Release();
gRealTexture = nullptr;
}
return NULL;
}
}
gImmediateContext->CopyResource(gRealTexture, texture2D);
D3D11_MAPPED_SUBRESOURCE mapped;
hr = gImmediateContext->Map(gRealTexture, 0, D3D11_MAP_READ_WRITE, 0, &mapped);
if (FAILED(hr)) {
gRealTexture->Release();
gRealTexture = NULL;
return NULL;
}
unsigned char *source = static_cast<unsigned char *>(mapped.pData); //Here I get the pixel buffer data
问题是它是全高清分辨率(1920x1080(。我想减少分辨率(例如1280x720(,因为我需要通过网络发送source
。而且我真的不需要完整的高清图像。
在我获得像素缓冲区之前,可以轻松使用DirectX吗?
谢谢
创建一个较小的分辨率纹理,使用全屏幕四边形将texture2d
渲染到较小的纹理(但要缩小到新尺寸(。确保双线性过滤已打开。
然后复制并映射较小的纹理。CopyResource需要相同的维度。
一些资源:
DX11辅助库
呈现到纹理
dx11邮政处理模糊
模糊设置与我在说的内容相同,只有使用模糊着色器而不是使用简单的纹理着色器。
相关文章:
- 如何使用 DXGI 格式DXGI_FORMAT_R1_UNORM创建 2D 纹理?
- OpenGL 2D游戏只绘制第二个精灵纹理而不是第一个
- DirectX 11比例纹理2d
- 使用 DX11 加载 2D 纹理时内存泄漏
- 将纹理添加到 2D 元素
- DirectX 11 - 如何创建非常简单的 2D 纹理
- 纹理未应用于 2D 几何体
- OpenGL 2D纹理抖动/脉动
- 在OpenGL中绘制多个2D纹理
- OpenGl 2d 纹理重复(不同设备上的结果不同)
- 在OpenGL 2.1中,即使在2D空间(具有2D纹理),也可以安全使用3D TEX坐标
- OpenGL:从数据阵列生成2D纹理以显示在四边形上
- 将2D图像映射到3D纹理
- 如何在OpenGL中将两个不同的图像渲染为两个不同图元?2D纹理阵列
- 从2D纹理上的位置(x,y)计算.obj文件中的vt(u,v)坐标
- 覆盖openGL 2d纹理中的每像素像素
- 如何处理 2D opengl 项目的纹理
- 使用旋转矩阵旋转纹理2d
- 直接2d.纹理图集创建
- GLSL:渲染 2D 纹理