Sign in to follow this  

How to draw surface to screen?

This topic is 3113 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 want to load 25 bitmap files into memory. Twenty-five bitmap files have 800x600 resolution. I define LPD3DXRENDERTOSURFACE surface and I use D3DXCreateRenderToSurface function to create surface object. I can't find "load bitmap into memory" function and "draw" function. One bitmap is filled in one frame. One frame is copied into backbuffer before it displays to the screen. First bitmap, second bitmap, third bitmap, etc can be copied from main memory to video memory directly, and then "draw" function can display one frame each 15-30 seconds. I am new to Direct3D. I am not familiar to 3D. I want to focus how to draw 2D to the screen. Can you please write example code for me? I may not need to use "load bitmap into memory" function. Where can I find "copy bitmap from memory to surface" function? It can point to pixel buffer. Thanks for your assistance.

Share this post


Link to post
Share on other sites
Hi, would you please be kind to write sample code? You can show an example how pixel buffer is copied into video memory using Surface9's LockRect and displays surface to the screen. DirectX 10 does not have the feature. What is another option? Thanks...

Share this post


Link to post
Share on other sites
Unfortunately, I haven't used D3D10, and all my D3D9 code is actually SlimDX code (managed wrapper over D3D9) so I doubt it'd be helpful here if you really do need a sample. It might be worth noting, however, that I'm using textures directly for all my 2d images instead of mucking about with intermediate surfaces -- the only time surfaces and RenderToSurface comes up in my code is when I want to draw a bunch of textures to a single texture so I can alpha-blend them as a single group rather than each individually, and when I want to load from already-in-memory System.Drawing.Bitmap-s rather than directly from files. You can probably just use D3DXCreateTextureFromFile and sidestep surfaces entirely

And it looks like in both cases, with D3D10, I would end up using ID3D10Texture2D::Map and/or D3DX10CreateTextureFromFile instead.

Share this post


Link to post
Share on other sites

This topic is 3113 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this