• Advertisement

Archived

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

Sharing Back Buffer between process

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

The subject is self explaining I think Somebody knows how can I render in the same video or system memory back buffer. In OpenGL or DirectX thanks

Share this post


Link to post
Share on other sites
Advertisement
Sharing backbuffers between what? Applications? It would probably be very difficult to synchronize the two applications so neither draws to the buffer at the wrong time. But I can''t imagine why you''d want to do this. Can you explain a little more?

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
Imagine an application Calc3D.exe & notepad3D.exe both rendering in the same backbuffer sincronized with an event, and a third bliting or fliping this back buffer to the front buffer when a semaphore is reached to the number of applictions currently running.

It could be a 3D GDI System for applications compiled for this GDI. But the GDI can''t render all the "Frames" (like windows in Win32) because the "Frame" information of every application is in his memory address space, not in the GDI3D.exe memory address space. Therefore there is each appliction''s responsibility to render his own "Frame".

what do you think is it impossible to do.

thanks for your attention and excuse my english

kenic.

Share this post


Link to post
Share on other sites
Yes but I want that another application that wasn''t write by me can share the same 3D enviroment.

An example is a virtual desktop.
Imagine application 1 the "Recycle bin" an the application 2 a picture on the wall that was playing an .MPG. both rendered in the same virtual room.

what do you think?

thanks, and excuse my english

Share this post


Link to post
Share on other sites
I would suggest using windows messages to tell the applications when to draw or what to draw. Like:


  
#define WM_SENDBUFFERINFO (WM_USER+1)
#define WM_UPDATEBUFFER (WM_USER+2)

...

// Send the pointer to the backbuffer:

PostMessage( OtherWnd, WM_SENDBUFFERINFO, (WPARAM)lpDDBuffer, NULL );
// Tell the other app to call Flip() or whatever:

PostMessage( OtherWnd, WM_UPDATEBUFFER, NULL, NULL );

Then the other application will retrieve those messages and handle them properly. Only one application will create and destroy the backbuffer, and it will send the buffer info to the others.

This is sort of tricky to do well; you''ll need good error-handling to make sure the pointer is valid (maybe you''ll pass &lpDDBuffer instead of lpDDBuffer, and have the other application check to make sure lpDDBuffer is non-NULL) and you''ll need to check to see if another application is busy writing to the buffer by reading the errors DirectDraw returns.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
thanks CGameProgrammer it runs well.
Three applications rendering some triangles in a 1152x864x16 back buffer on a GeForce MX at 140 frames, and I think it could be better if I optimize it.

thanks.

Share this post


Link to post
Share on other sites

  • Advertisement