Jump to content
  • Advertisement
Sign in to follow this  
Marmin

frontbuffer/backbuffer pixel change.

This topic is 5009 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

Hi, I am studying the process of modifying pixels on a surface. (Direct3D). This is what happens. - The backbuffer saves to disk (snapshot), but, when I try to access the pixels (pBits) directly, a run-time exception occurs. - The frontbuffer saves to disk, I can access the pixels and change them, but the frontbuffer only gives a black screen. Anyone had these 'symptoms' ? Regards, Marcel.

Share this post


Link to post
Share on other sites
Advertisement
Simply put, you should not be modifying the backbuffer OR the frontbuffer. It is a general rule that these buffers need to be intact, and only should be touched by D3D itself. The procedure for image post-processing is like this:

(1) Render the entire scene into a rendertarget (a rendertarget is a texture created with D3DUSAGE_RENDERTARGET that serves as an output for a pixel shader, just like the backbuffer)

(2) Render the rendertarget as a 2D-quad and perform some kind of algorithm in the vertex or pixel shader.

If you don't want to use shaders, you can lock the rendertarget after step (1) and then render as a 2D quad (perhaps using ID3DXSprite). However, locking surfaces in video memory is *extremly* slow and should be avoided on a per-frame basis.

There is a sample in the SDK (Post-Process) that demonstrates some imaging effects with HLSL.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!