• Advertisement

Archived

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

Just needing a straight answer...

This topic is 6589 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 have posted this before but the replies weren''t satisfying enough. I just need a straight answer. How can you get a pointer to the backsurface? All things have been done (like creating the directdraw object and stuff). Fill in the dots. backbufferptr=(unsigned char *)...

Share this post


Link to post
Share on other sites
Advertisement
The prior answers were correct. Once you have the initialized DirectDraw surface interface object for the backbuffer, you simply lock it, then use the lpsurface pointer retrieved from the description structure you passed to the lock function. Refer to the SDK on locking surfaces for the exact method of doing this.

If that''s not the answer you need, please explain exactly what you are trying to do -- maybe your question isn''t correct (the terms you are using).



Jim Adams
Game-Designer/Author
tcm@pobox.com
http://www.lightbefallen.com
http://www.basicelectronics.com

Share this post


Link to post
Share on other sites
Now I get it! (i hope) Tell me if this is the right way:

{
lpDDSBack->Lock(NULL,&ddsurfacedesc,DDLOCK_WAIT,NULL);
backbuffer=(unsigned short *)ddsurfacedesc.lpSurface;
};

Thanx for your patience.

Share this post


Link to post
Share on other sites
I think this would work too:

backbuffer = lpDDSBack->Lock(NULL,&ddsurfacedesc,DDLOCK_WAIT,NULL);

Share this post


Link to post
Share on other sites
No, this won''t work.
IDIRECTDRAWSURFACE->Lock doesn''t return the pointer to the surface but a return value of type HRESULT (error code).
And bosjoh, you got it! That''s the one and only way to do it. And please don''t forget to unlock the surface after you''re done.

Correct me if I''m wrong.

Share this post


Link to post
Share on other sites
Hi,
sure that this will work ? I thought you''d have to pass DDLOCK_SURFACEMEMORYPTR to the Lock() function like this :


lpDDSBack->Lock(NULL, &ddsd, DDLOCK_WAIT / DDLOCK_SURFACEMEMORYPTR, NULL);
USHORT* buffer = (USHORT*)ddsd.lpSurface;


CU

Graphix Coding @
Skullpture Entertainment

Share this post


Link to post
Share on other sites

  • Advertisement