If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
How to render the scene to two or more forms use the same device at once? If i have three forms did i need
create three device for them(one form per device) ?
This functionality is exposed through DeviceCreateShared function inside "PXT.Headers.pas", but in "PXT.Graphics.pas" there is no equivalent DeviceInit function for it yet. Please wait for an incoming Afterwarp update, which includes the fix for image loading on Windows 7, and I'll include an example for multiple forms there.
The idea is that you create a shared device for secondary forms - in Direct3D backend this translates to just an additional swap-chain, while in OpenGL it creates an OpenGL context sharing. For rendering, you'll need to issue rendering calls to the appropriate device, but all resources all shared, so you can use them with any of the devices.
Please download both latest SDK and Pascal bindings from February 2, 2020, which include MultiplePanels example for both Delphi and FreePascal/Lazarus.
The main idea is to create two devices, where one will be primary and the second one will be a "shared" device, created with "DeviceInitShared". Shared devices must have same pixel format and multisampling parameters as the primary one. Then simply call the appropriate TDevice.BeginScene / TDevice.EndScene blocks to render to a device associated with a particular window handle.
Shared devices have been extensively tested with modern binaries that use Direct3D 11.x and OpenGL 3.3+ or 4.6. However, there is a known issue in "legacy" build using Direct3D 9, where it may have glitches. In either case, if you get any problems, please let me know.
Comment