在 ENTER_FRAME 期间在多个 Program3D 之间切换的计算成本是否昂贵?
设置 Stage3D
的 Context3D
进行渲染时,在 Event 中的
循环?Program3D
之间切换是否昂贵/不好的做法.ENTER_FRAME
我手头没有例子,但我很想知道是否在这种情况下会使用程序之间的这种交替,以及帧速率是否会受到相当大的影响。
When setting up a Stage3D
's Context3D
for rendering, is it expensive / bad practice to switch between Program3D
's in an Event.ENTER_FRAME
cycle?
I don't have an example at hand, but I'm curious to know if there's such situations where this alternation between programs would be used and if the frame-rate would suffer considerably.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与之相关的是一些成本,但我不认为它很昂贵。当然,如果您的场景中有多个着色器,则您将必须在每一帧的 Program3D 之间进行切换 - 您只是不想这样做超出必要的范围。因此,解决方案是渲染特定着色器的所有网格,然后转到下一个着色器,依此类推。
There is some cost associated with it, but I don't think I'd call it expensive. Of course, if you have more than one shader in your scene, you're going to have to switch between Program3Ds every frame - you just wouldn't want to do that more than necessary. So, the solution is to render all the meshes for a particular shader, then move on to the next shader, etc.