惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Troy Hunt's Blog
Blog — PlanetScale
Blog — PlanetScale
Engineering at Meta
Engineering at Meta
F
Full Disclosure
Recorded Future
Recorded Future
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
博客园_首页
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Hacker News: Front Page
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
博客园 - 司徒正美
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
Cloudbric
Cloudbric
PCI Perspectives
PCI Perspectives
有赞技术团队
有赞技术团队
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
L
Lohrmann on Cybersecurity
量子位
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tailwind CSS Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
N
News and Events Feed by Topic
罗磊的独立博客
T
Threat Research - Cisco Blogs
Schneier on Security
Schneier on Security
T
Tor Project blog
IT之家
IT之家
M
MIT News - Artificial intelligence
S
Security @ Cisco Blogs
O
OpenAI News
AI
AI
S
Securelist
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
月光博客
月光博客
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题

博客园 - zim.NET

悼念友人 博客搬家了 函数调用中的黑客技术 混乱你的代码 - zim.NET - 博客园 这么个女孩,你娶吗(转) 被误传了数千年的七句话(精简版_转载) 找工作故事之篇二 找工作故事之开篇 - zim.NET - 博客园 失落的阳光,陈酿的悲伤——许美静 一行命令解决批量重命名 一个空间换时间算法 求最长公共子序列 最小生成树算法讨论 用EditPlus打造你自己的IDE 将PPT内容导出为JPG图片 C/C++ 误区:fflush(stdin) 关于"extern" 闲谈成员初始化列表 脑筋急转弯3600题
3D学习笔记之一句话总结(不断更新中)
zim.NET · 2007-11-07 · via 博客园 - zim.NET

1.D3D的创建过程:(InitD3D)
D3D对象g_pD3D通过Direct3DCreate9(D3D_SDK_VERSION)创建
而后创建D3D设备g_pd3dDevice由g_pD3D->CreateDevice(...)创建.

2.绘图: (Render)
先清除后置缓冲并设置为背景色用g_pd3dDevice->Clear(...)
渲染:  SUCCEEDED(g_pd3dDevice->BeginScene())
       g_pd3dDevice->EndScene();

最后显示后置缓冲画面:
        g_pd3dDevice->Present(...);

3.绘图操作的安排(利用消息循环中空闲时间)
常将Render()函数放于WinMain()消息循环内部.
获取消息用PeekMessage(...) ----相比于GetMessage(),PeekMessage()在未得到消息时仍将占用一段时间片.即可利用此间空闲时间.

if(PeekMessage(...)){
    TransalteMessage(...);
    DispatchMessage(...);
}
else{
    Render();    //利用空闲时间绘图
}

4.顶点缓冲
用户定义自由顶点格式(FVF)而后通过g_pd3dDevice->CreateVertexBuffer(...)创建顶点缓冲
疑问手:  顶点缓冲的创建是否就是申请一片内存空间? 还有其它什么作用在这个函数里?

创建顶点缓冲有一个指向顶点的指针输出..
(注意这里传入的是VOID**,为什么要这样,想知道的话好好了解一个函数参数的拷贝,呵呵)

锁住内存区?: g_pVB->Lock(...)
然后memcpy(...)将自己定义的一个顶点数组拷贝过来.
再UnLock()

怎么绘制出顶点缓冲内的东西?
在Render()里,BeginScene()后作如下操作:
   1) 使包含顶点信息的顶点缓冲绑定到一个设备数据流  g_pd3dDevice->SetStreamSource(...)
   2) 向D3D指定顶点着色信息,大多数情况只指定FVF格式.   g_pd3dDevice->SetFVF(...)
   3) 调用输出几何信息的DrawPrimitive()函数     g_pd3dDevice->DrawPrimtive(...)