Jump to content
  • Advertisement
Sign in to follow this  
outlawhacker

Texture data storage

This topic is 4585 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm doing rendering to texture in shaders to store positions of particles. I'm trying to create a DX version of Lutz Latta's "Building a million particle system". I've managed to to simple rendering of my billboards, but when I try to transfer my computed positions to my render target something goes wrong. I'm doing it like this (pseudo-code 'cause I don't have my project here): In cpp:
// Create a render target texture of same width and height as the texture I'm
// getting old values from
CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET, FMT_A32R32G32B32,...)

// Store original render target (backbuffer)
// Get the surface of my texture
// Set surface as render target
// DrawPrimitive()...
// Set back buffer to render target

// Store position values in a another texture


In the shader:
// Get values in vertex shader


float4 pos = tex2Dlod(PositionMap, uvVertex);
float4 vel = tex2Dlod(VelocityMap, uvVertex);

pos += vel;

return pos;

// This position value should now be rendered to my render target texture


The values are correct in the first vertex shader pass, but they don't seem to be stored correctly when rendering them to the next texture. I'm drawing a quad to get the DrawPrimitive going. Is there anything I should think of when rendering to a texture? Size of texture? Format? Thanks in advance for help :)

Share this post


Link to post
Share on other sites
Advertisement
D'oh! Embarrasing!

I did not run my render pass, only the update pass. :/

That only cost me half a day...yawn...

Thanks for helping :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!