开发者

DirectX: How to render a texture to screen (DirectX10.1)

开发者 https://www.devze.com 2022-12-30 01:08 出处:网络
I\'m having some troubles finding out how i can render an offscreen texture to the screen. Can anyone help me wi开发者_运维百科th pointing me in the right direction?

I'm having some troubles finding out how i can render an offscreen texture to the screen.

Can anyone help me wi开发者_运维百科th pointing me in the right direction?

Thx


Basically, you render a rectangle the size of the screen, setting as the texture the off-screen texture you rendered.

Now, for some details:

It's probably best to just generate your desired vertex buffer beforehand. You'll want a position component (X, Y, Z, though you technically don't need Z), and a UV component. I recommend making one of these for use by the entire program, with upper left corner being position 0, 0, 0 with UV 0, 0 and the bottom right being 1, 1, 0 with UV 1, 1. Then, to render your texture, set your texture (as you would any other texture), set your matrix/matrices to scale that to whereever you want it, and send off a drawcall with that vertex buffer.

0

精彩评论

暂无评论...
验证码 换一张
取 消