Just asking again.
How do you retrieve a pointer to the attached backsurface?
And do you have to lock it or can you just leave it unlocked and use flip()?
Pointer to the backsurface
first off READ THE DOCS
Also, I think there is a funtion called GetAttactedSurface, if it is attached.
No, you don''t lock it to flip it. That probably would give an error.
Also, I think there is a funtion called GetAttactedSurface, if it is attached.
No, you don''t lock it to flip it. That probably would give an error.
Well, the docs aren''t really good in explaining this.
The function GetAttachedSurface only allocates the surface,
the thing I want is the pointer.
Something like the lpSurface member of the DDSURFACEDESK structure.
And another thing:
Does the pointer change after flipping (like it will change to the primary surface pointer)?
The function GetAttachedSurface only allocates the surface,
the thing I want is the pointer.
Something like the lpSurface member of the DDSURFACEDESK structure.
And another thing:
Does the pointer change after flipping (like it will change to the primary surface pointer)?
Well lets see you have something like this no?
LPDIRECTDRAWSURFACE4 screen; // DirectDraw Primary Surface
LPDIRECTDRAWSURFACE4 dbuffer; // DirectDraw Back sureface
you then create your flipping chain ect. To do things like draw pixels or own custom drawing stuff you just lock the dbuffer. Then unlock,and call flip when your rdy.
LPDIRECTDRAWSURFACE4 screen; // DirectDraw Primary Surface
LPDIRECTDRAWSURFACE4 dbuffer; // DirectDraw Back sureface
you then create your flipping chain ect. To do things like draw pixels or own custom drawing stuff you just lock the dbuffer. Then unlock,and call flip when your rdy.
I decided to expand on my original post a bit ,since im not sure if you know how to lock surfaces.
Here is what else you would do.
int dbufferpitch; // the pitch of the surface see docs
DDraw_Lock_dbuffer(void){
memset(&ddsd,0,sizeof(ddsd));
ddsd.dwSize=sizeof(ddsd);
dbuffer->Lock(NULL,&ddsd,DDLOCK_WAIT / DDLOCK_SURFACEMEMORYPTR,NULL);
dbufferpitch = ddsd.lPitch;}
Then draw your custom stuff,and unlock.
Also you have to get the dbufferpitch everytime ,you cant just use the old one.
Edited by - Zenroth on 1/3/00 1:28:40 AM
Here is what else you would do.
int dbufferpitch; // the pitch of the surface see docs
DDraw_Lock_dbuffer(void){
memset(&ddsd,0,sizeof(ddsd));
ddsd.dwSize=sizeof(ddsd);
dbuffer->Lock(NULL,&ddsd,DDLOCK_WAIT / DDLOCK_SURFACEMEMORYPTR,NULL);
dbufferpitch = ddsd.lPitch;}
Then draw your custom stuff,and unlock.
Also you have to get the dbufferpitch everytime ,you cant just use the old one.
Edited by - Zenroth on 1/3/00 1:28:40 AM
Important to note that the above should be
DDLOCK_WAIT / DDLOCK_SURFACEMEMORYPTR
not
DDLOCK_WAIT / DDLOCK_SURFACEMEMORYPTR
DDLOCK_WAIT / DDLOCK_SURFACEMEMORYPTR
not
DDLOCK_WAIT / DDLOCK_SURFACEMEMORYPTR
You dont have to specify DDLOCK_SURFACEMEMORYPTR its done so by default. And to the orginal poster what exactly is your question? Youre not really clear on what you need help with.
Josh
Josh
Here''s a quick overview (assuming full screen):
1) Create a complex, flipping primary surface.
2) Call the new primary''s GetAttachedSurface() to get the active DXSurf pointer.
3) When rendering the scene, lock the active surf (the getattachedsurf() one) to get the actual surface pointer. Draw to that pointer, then unlock the surface.
4) Call Flip() on the primary surface
5) start again at 3. You don''t need to swap primary and active DXSurf pointers becuase DX handles this for you (which personally is a BIG thorn in my side, but...)
Rock
1) Create a complex, flipping primary surface.
2) Call the new primary''s GetAttachedSurface() to get the active DXSurf pointer.
3) When rendering the scene, lock the active surf (the getattachedsurf() one) to get the actual surface pointer. Draw to that pointer, then unlock the surface.
4) Call Flip() on the primary surface
5) start again at 3. You don''t need to swap primary and active DXSurf pointers becuase DX handles this for you (which personally is a BIG thorn in my side, but...)
Rock
Well,
I'll explain the thing I want to do:
I want to write my own blitting (alpha blending) routines in assembler. To do this you must have a pointer to the screen. But in some situations it is faster to use the DirectX (hardware accelerated) blitter. The only thing to do this IMO is to get a pointer to the backsurface.
First use your own blitting routines and then the DirectX ones. With buffering of course.
Thanx for your replies, but one thing is still missing:
The line backbuffer=(unsigned short *)...
The ... needs to be filled in.
Edited by - bosjoh on 1/4/00 12:35:10 AM
I'll explain the thing I want to do:
I want to write my own blitting (alpha blending) routines in assembler. To do this you must have a pointer to the screen. But in some situations it is faster to use the DirectX (hardware accelerated) blitter. The only thing to do this IMO is to get a pointer to the backsurface.
First use your own blitting routines and then the DirectX ones. With buffering of course.
Thanx for your replies, but one thing is still missing:
The line backbuffer=(unsigned short *)...
The ... needs to be filled in.
Edited by - bosjoh on 1/4/00 12:35:10 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement