Jump to content
  • Advertisement
Sign in to follow this  
Bearhugger

OpenGL Problems rendering to a surface

This topic is 3191 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 porting my 2D game engine from SDL/OpenGl to DirectX 9.0c. I need to be able to create bitmaps and blit stuff on them, so I figure I need to render to a surface. I'm using the ID3DXRenderToSurface interface to handle the details about rendering. Problem is, this is VERY slow. I suppose it happens because my texture does not have D3DUSAGE_RENDERTARGET specified so the interface has to render to its internal texture, then copy to my texture. So I try putting the render target flag, but now it complains that it is not in the default pool, and that's not exactly better because that would mean that I have to re-render everything when my device is lost, and I might need to lock too. (But it fixes the speed problem if I put default.) There's also another problem with rendering to a surface: the parts where nothing was rendered on gets garbage like what was previously on the screen the last time I ran the engine. I doubt I'm the first one trying to do a simple 2D engine with DirectX 9.0c, so how is this usually done?

Share this post


Link to post
Share on other sites
Advertisement
Render on the D3DPOOL_DEFAULT surface, then copy it to a D3DPOOL_SYSTEMMEM surface yourself when you need it.
And clear the surface after setting it before you do any rendering on it to avoid seeing video memory dumps.

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!