Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Forcas

Direct Access to Backbuffer in D3D8

This topic is 6102 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! Lately I''ve been trying to get direct access to the backbuffer, and it hasn''t been working. Here''s how I tried it:
  
// Globals

LPDIRECT3DSURFACE8 lpd3ds;
int *iBuffer;
D3DLOCKED_RECT LockRect;

// COnstants

#define _RGB32BIT(a,r,g,b) ((b) + ((g) << 8) + ((r) << 16) + ((a) << 24))

//In my init code

lp3dd->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &lpd3ds);
LockRect.Pitch = 3200;
LockRect.pBits = &iBuffer;

//In my Render loop

lpd3ds->LockRect(&LockRect, NULL, NULL);
iBuffer[x+(y*LockRect.Pitch >> 3)] = _RGB32BIT(255, 255, 100, 255);
lpd3ds->UnlockRect();

  
I suspect that my problem is the pitch. How do you get the pitch of the backbuffer? I just guessed that it was 3200, because I''m using 800X600X32 Am I on the completely wrong track? -Forcas
"Elvis is alive. He is Barney the purple dinosaur. He is the pied piper that leads our children into the wages of sin and eternal damnation."

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!