Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

I need to copy a pixel from one DirectDrawSurface to another FAST

I need to copy a pixel from one DirectDrawSurface to another FAST

I need to copy a pixel from one DirectDrawSurface to another FAST

I'm making a basic (very basic) pseudo 3D game and it requires a lot of per pixel calculations.  Basically, I'm just running software stretching algorithms to stretch textures into a variety of square and trapezoid shaped quads (and also a few triangles).

Now, originally I had all my surfaces in Video Memory and to draw the floor and ceiling at 640x480 took about 300 milliseconds.  An absurdly long time considering that games like Quake2 and Half-Life could access every pixel at least 20 times a seconds at that resolution on a respectable machine (years ago).

So, as a test, I stored all of my texture surfaces in system memory.  Sure enough, the rendering time decreased by an order of magnitude (about 30 milliseconds).  Previously, the "texture" pixels were being taken from video memory, to the cpu and then back to video memory to be put on the draw surface.  With the textures in system memory, the texture pixels (texels) get to the cpu much quicker.

However, now it crashes my brothers computer and probably a lot of other older machines (works fine on mine).  We updated his direct x, but since the video card is a 4 year old OEM TNT, the drivers can't be updated.

Do you either (a) have any idea why this would crash a computer, or (b) know how to get directdraw to copy pixels directly from one surface to another (without having the pixel sent to the cpu).  Right now I'm using pointers to directly access the surface memories causing the slowdown.  Bliting one pixel at a time doesn't make it faster (figured that would keep things in hardware, but the blt overhead on a per pixel basis is just absurd).

I'm writing this in object pascal (delphi) but I can read C.

Any ideas on how to keep all the surfaces in video memory and keep the speed up would be greatly appreciated.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close