Multisample and render to texture problem

Started by
2 comments, last by ETPlayer 20 years, 1 month ago
Hi I''m a newb to DirectX programming and I''m having a problem with rendering to textures with multisampling turned on. I create a device with MultiSampleType = D3DMULTISAMPLE_2_SAMPLES set in the present parameters. Then when try I render to texture my application runs amok - it just crashes the system if I''m lucky but it once managed to corrupt the source code and once the project files. To make it more interesting it doesn''t matter if I have anti aliasing turned on in the rendersates. What''s going on? It works fine when I just render to the back buffer and I can see the antialiasing. Do I have to have some special surface as a render target to use multisampling? Thanks for any help Radek
Advertisement
What format texture are you trying to render to? If I remember correctly, I believe that you cannot use multisampling when rendering to floating point textures.

neneboricua
A8R8G8B8 - same as the back buffer.
I looked into it a bit more and I think you must create your render target with the appropriate multisampling flag for this to work. Take a look at CreateRenderTarget to see what I mean. Also, look up "Full-Scene Antialiasing" in the DX docs. That section talks about some of the requirements necessary for multisampling.

Since texture creation doesn''t accept any multisampling flags, I don''t think you can do multisampling on a render target texture. What you can do though, is create a texture render target that is, say twice as big as your original. Render to this target, then copy the data to a smaller texture using StretchRect or some similar function.

neneboricua

This topic is closed to new replies.

Advertisement