如何一次性绘制多个纹理??
我的窗体由这4个角和4个边框组成,并且这些部分被放在了同一张纹理图片里。
如果渲染一个窗体,要调用8次DrawPrimitiveUP()函数的话,感觉有点不划算。
有什么办法可以快速把这几个部分绘制出来?
是可以一次性绘制出来,还是只能调用8次DrawPrimitiveUP() ??
- C/C++ code
CustomVertex objData[] ={ // 左上角 { x, y, 0, 1, col, LU_left/width, LU_top/height }, { LU_right-LU_left+x, y, 0, 1, col, LU_right/width, LU_top/height }, { LU_right-LU_left+x, LU_bottom-LU_top+y, 0, 1, col, LU_right/width, LU_bottom/height }, { LU_right-LU_left+x, LU_bottom-LU_top+y, 0, 1, col, LU_right /width, LU_bottom/height }, { x, LU_bottom-LU_top+y, 0, 1, col, LU_left/width, LU_bottom/height }, { x, y, 0, 1, col, LU_left/width, LU_top/height }, // 左下角 { x, y, 0, 1, col, LD_left/width, LD_top/height }, { LD_right-LD_left+x, y, 0, 1, col, LD_right/width, LD_top/height }, { LD_right-LD_left+x, LD_bottom-LD_top+y, 0, 1, col, LD_right/width, LD_bottom/height }, { LD_right-LD_left+x, LD_bottom-LD_top+y, 0, 1, col, LD_right /width, LD_bottom/height }, { x, LD_bottom-LD_top+y, 0, 1, col, LD_left/width, LD_bottom/height }, { x, y, 0, 1, col, LD_left/width, LD_top/height }, // 右上角 { x, y, 0, 1, col, RU_left/width, RU_top/height }, { RU_right-RU_left+x, y, 0, 1, col, RU_right/width, RU_top/height }, { RU_right-RU_left+x, RU_bottom-RU_top+y, 0, 1, col, RU_right/width, RU_bottom/height }, { RU_right-RU_left+x, RU_bottom-RU_top+y, 0, 1, col, RU_right /width, RU_bottom/height }, { x, RU_bottom-RU_top+y, 0, 1, col, RU_left/width, RU_bottom/height }, { x, y, 0, 1, col, RU_left/width, RU_top/height }, // 右下角 { x, y, 0, 1, col, RD_left/width, RD_top/height }, { RD_right-RD_left+x, y, 0, 1, col, RD_right/width, RD_top/height }, { RD_right-RD_left+x, RD_bottom-RD_top+y, 0, 1, col, RD_right/width, RD_bottom/height }, { x, RD_bottom-RD_top+y, 0, 1, col, RD_right /width, RD_bottom/height }, { x, RD_bottom-RD_top+y, 0, 1, col, RD_left/width, RD_bottom/height }, { x, y, 0, 1, col, RD_left/width, RD_top/height }// 4个边框顶点略// ...};
[解决办法]
你的游戏的几百个控件,只要是2D的,我可以只用一次DP就全部画出来。前提是只用一次PASS,你信不?
[解决办法]
明明我在之前的几个帖子里面说过很多次了的说。
因为都在一个问了里面,所以使用D3DXSprite也可以,自己模拟可以。
实在不行,一次生成所有定点也可以啊,只要你不死抱着三角形扇不放就行。
[解决办法]
我说的是D3D的基本功能
[解决办法]
~~用顶点索引可以啊!
[解决办法]
你下载HGE引擎代码看看它是怎么实现的。我的带码封装成了一个2D渲染库,牵扯到很多类所以不方便发出
[解决办法]
这是可以的阿,因为都是同一个纹理,不用切换渲染状态。所以只要用tri_list的方式一次把那些三角形都连起来就可以了阿。
[解决办法]
为什么要线段?回复内容太短了!
[解决办法]