DirectX9 表面

2023-12-20 09:32
文章标签 表面 directx9

本文主要是介绍DirectX9 表面,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

The most important methods of IDirect3DSurface9 are:

LockRect—This method allows us to obtain a pointer to the surface memory. Then, with some pointer arithmetic, we can read and write to each pixel in the surface.
UnlockRect—After you have calledLockRectand are done accessing the surface’s memory, you must unlock the surface by calling this method.
GetDesc—This method retrieves a description of the surface by filling out aD3DSURFACE_DESCstructure.


we have provided the following code block that locks a surface and colors each pixel red:


// Assume _surface is a pointer to an IDirect3DSurface9 interface.
// Assumes a 32-bit pixel format for each pixel.
// Get the surface description.
D3DSURFACE_DESC surfaceDesc;
_surface->GetDesc(&surfaceDesc);
// Get a pointer to the surface pixel data.
D3DLOCKED_RECT lockedRect;
_surface->LockRect(
&lockedRect,// pointer to receive locked data
0, // lock entire surface
0); // no lock flags specified
// Iterate through each pixel in the surface and set it to red.
DWORD* imageData = (DWORD*)lockedRect.pBits;
for(inti=0;i<surfaceDesc.Height; i++)
{
for(intj=0;j<surfaceDesc.Width; j++)
{
// index into texture, note we use the pitch and divide by
// four since the pitch is given in bytes and there are
// 4 bytes per DWORD.
int index=i*lockedRect.Pitch/4+j;
imageData[index] = 0xffff0000; // red
}
}
_surface->UnlockRect();


TheD3DLOCKED_RECTstructure is defined as:

typedef struct _D3DLOCKED_RECT {
INT Pitch; // the surface pitch
void *pBits; // pointer to the start of the surface memory
} D3DLOCKED_RECT;

这篇关于DirectX9 表面的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/515547

相关文章

【电子通识】半导体工艺——保护晶圆表面的氧化工艺

在文章【电子通识】半导体工艺——晶圆制造中我们讲到晶圆的一些基础术语和晶圆制造主要步骤:制造锭(Ingot)、锭切割(Wafer Slicing)、晶圆表面抛光(Lapping&Polishing)。         那么其实当晶圆暴露在大气中或化学物质中的氧气时就会形成氧化膜。这与铁(Fe)暴露在大气时会氧化生锈是一样的道理。 氧化膜的作用         在半导体晶圆

ASTER L2 表面反射率 SWIR 和 ASTER L2 表面反射率 VNIR V003

ASTER L2 Surface Reflectance SWIR and ASTER L2 Surface Reflectance VNIR V003 ASTER L2 表面反射率 SWIR 和 ASTER L2 表面反射率 VNIR V003 简介 ASTER 表面反射率 VNIR 和 SWIR (AST_07) 数据产品 (https://lpdaac.usgs.gov/documen

NASA:ASTER L2 表面辐射率(E(辐射率)和 T(地表温度)) V003数据集

ASTER L2 Surface Emissivity V003 ASTER L2 表面辐射率 V003 简介 ASTER L2 地表发射率是一种按需生成的产品((https://lpdaac.usgs.gov/documents/996/ASTER_Earthdata_Search_Order_Instructions.pdf)),利用 8 至 12 µm 光谱范围内的五个热红外(TIR)

Python-MNE-源空间和正模型07:修复BEM和头表面

有时在创建BEM模型时,由于可能出现的一系列问题(例如,表面之间的交叉),表面需要手动校正。在这里,我们将看到如何通过将表面导出到3D建模程序blender,编辑它们,并重新导入它们来实现这一点。我们还将给出一个简单的例子,说明如何使用pymeshfix来修复拓扑问题。 本教程的大部分内容都是基于Ezequiel Mikulan的ezemikulan/blender_freesurfer。 im

UE5 摄像机图像采集到材质 映射到 UI 和 物体表面

一.创建SceneCapture2D的组件 二.创建用于 映射的 贴图 三.将RenderTarget贴图放到SceneCapture2D的摄像机上Scene Capture的TextureTarget 四.这个时候的映射贴图,产生的材质可以直接。放到Plane上。 五,但是如果要用于UI,还需要更改SceneCapture2D的摄像机的CaptureSource为 Fin

材料表面缺陷检测系统源码分享 # [一条龙教学YOLOV8标注好的数据集一键训练_70+全套改进创新点发刊_Web前端展示]

材料表面缺陷检测系统源码分享 [一条龙教学YOLOV8标注好的数据集一键训练_70+全套改进创新点发刊_Web前端展示] 1.研究背景与意义 项目参考AAAI Association for the Advancement of Artificial Intelligence 项目来源AACV Association for the Advancement of Computer Visi

秋招之路-链表面试题集合(二)

[图]program 2019-07-24 这是 herongwei 的第 80 篇原创 阅读本文大概需要 8.88 分钟 前言 链表是最基本的数据结构,面试官也常常用链表来考察面试者的基本能力,链表的操作也离不开指针,指针又很容易导致出错。综合多方面的原因,链表题目在面试中占据着很重要的地位。这里总结常见的链表面试题,希望对你有所帮助! 今天的题目 1、在 O(1) 时间删除链表节点。 2、

秋招之路-链表面试题集合(一)

[图]program 2019-07-22 这是 herongwei 的第 79 篇原创 阅读本文大概需要 6.66 分钟 前言 链表是最基本的数据结构,面试官也常常用链表来考察面试者的基本能力,链表的操作也离不开指针,指针又很容易导致出错。综合多方面的原因,链表题目在面试中占据着很重要的地位。这里总结常见的链表面试题,希望对你有所帮助! 今天的题目 1、单链表翻转 2、输入两个单链表,找出它

ThreeJS学习-光源对物体表面影响

在threejs中,用网格模型Mesh模拟生活中物体,所以threejs中模拟光照Light对物体表面的影响,就是模拟光照Light对网格模型Mesh表面的影响 //添加光源对象 点光源const pointLight = new THREE.PointLight(0xffffff, 1.0, 0, 0);pointLight.decay = 0.0//距离衰减 不随距离而衰减poin

【论文阅读】结构光三维表面成像

Structured-light 3D surface imaging: a tutorial 1. 基本原理2. 序列投影技术2.1.二进制图案2.2 灰度级图案(格雷图案)2.4.混合方法:相位偏移+格雷编码 3. 全帧空间变化颜色图案3.1.彩虹3D相机3.2.连续变化的颜色编码4.4 基于De Bruijn序列的条纹索引 5. 网格索引:2D 空间网格图案5.1.伪随机二进制数组 (