在运行时更新纹理? [英] Update a texture at runtime?

查看:88
本文介绍了在运行时更新纹理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello people,


目前我正在尝试在运行时更新多维数据集上的纹理。我使用DirectX工具包附带的DDSTextureLoader加载纹理。


更具体地说,我有一个多维数据集阵列,这些多维数据集是分配的纹理,很容易在初始渲染上加载不同的纹理,但我似乎无法改变即使按键,也可以在运行时将数组的任何设置值说成另一个值。 

解决方案

在DirectX 11中,是对创建和输入布局的调用,它绑定到1个着色器(顶点,几何,像素,等等)。 


当您为给定的多维数据集创建输入元素描述时,您可以使用不同的语义指定要传递到着色器的参数:"POSITION","TEXCOORD"和"TEXCOORD"。等等。


根据缓冲区中顶点数据的签名,将调用正确的着色器。


换句话说,如果你还没有创建另一个输入布局,其中包含新纹理,更新旧纹理,替换旧纹理等,因为纹理已被缓存,并且正在使用缓存副本,所以不会更改正在渲染的任何内容。 / p>

HTH





Hello people,

At the moment I am attempting to update a texture on a cube at runtime. I loaded the textures in using the DDSTextureLoader that came with the DirectX Tool Kit.

To be more specific I have an array of cubes which are allocated textures and it is easy enough to load the different textures on the initial render but I can not seem to change say any set value of the array to another value at run time on even a key press. 

解决方案

In DirectX 11, there is a call to Create and Input Layout, that is bound to 1 shader, (Vertex, Geometry, Pixel, whatever). 

When you create an Input Element Description for the given cube, you specify parameters that you are passing into the shader with different semantics: "POSITION", "TEXCOORD", etc.

Based on the signature of the vertex data in the buffer, the correct shader will be invoked.

In other words, if you have not created another input layout, with the new texture on it, updated the old one, replaced the old one, etc, nothing will change that is being rendered because the texture has been cached, and the cached copy is being used.

HTH



这篇关于在运行时更新纹理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆