Advertisement

Just needing a straight answer...

Started by January 07, 2000 01:14 PM
5 comments, last by bosjoh 25 years, 2 months ago
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 *)...
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
Advertisement
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.
I think this would work too:

backbuffer = lpDDSBack->Lock(NULL,&ddsurfacedesc,DDLOCK_WAIT,NULL);
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.
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
Graphix Coding @Skullpture Entertainmenthttp://www.skullpture.de
Advertisement
Only passing DDLOCK_WAIT works fine for me...

This topic is closed to new replies.

Advertisement