Jump to content
  • Advertisement
Sign in to follow this  

surface data

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

It's me, again :D
May someone give me some explanations about how surfaces hold color data?
I thought that sing LockRect you get a pointer (pBits) to an array of DWORDS of size width*height*sizeof(DWORD).
So i wrote this function, to get the color value of one pixel in a surface
DWORD SurfaceGetPixelColor(LPDIRECT3DSURFACE9 surface, int x, int y)
RECT rectangle;

rectangle.left = x;
rectangle.top = y;
rectangle.right = x+1;
rectangle.bottom = y+1;
DWORD color;

But i get an error for memcpy

Share this post

Link to post
Share on other sites
You need to make sure that the data in your surface is 32-bit. If it has any other format it will have a different size.

Share this post

Link to post
Share on other sites
Could you specify what error you're getting from memcpy. Also have you checked to make sure the lock is successful?

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!