PDA

View Full Version : DirectX



Thyandyr
19-05-2017, 11:34 AM
Still working my way around and learning what options there are available (for simple voxel engine for Delphi Berlin 10.1 for Windows). One striking thing seems to be lack of DirectX related posts and resources for Delphi, not only on this forum but everywhere. Why is that? Is it so horrible no one want’s to use it? Or is it so easy to use no headers, engines or tools are needed?

I'm aware of https://github.com/CMCHTPC/DelphiDX12 but nothing really refer to it.

How well does FMX perform?

SilverWarior
19-05-2017, 02:09 PM
If you are interested in making of voxel based engine then you might want to check this thread:
http://www.pascalgamedevelopment.com/showthread.php?15121-voxel-game&highlight=voxel+engine

As for why there aren't so many DirectX based resources for Delphi:
First reason is the sheer fact that Delphi has pretty high price so not many game developers are using it. Most tend to use FPC/Lazarus instead since it is free.
Another reason is that more and more game developers in general tend to go OpenGL way due to its cross-platform compatibility while with DirectX you are limited only to Microsoft based platforms.

As for using FMX for game development:
Based on my limited experience with older versions of FMX it isn't very suitable for game development due to its poor performance. Maybe in recent version they managed to improve the situation but I doubt it could compete with other graphical engines performance-vise.

Thyandyr
19-05-2017, 02:53 PM
I'm aware of Laggyluks thread, I even have his code for Free/Lazarus. Unfortunately it depends on several external units that have changed since, so it is beyond me to compile it, but I can of course just read it, there seems to be many clever cool things within it.

My Vox engine doesn't need to be very powerful as it is just a side aspect of the main project, but naturally I want to put my effort into something that can be extended if needs to, so solid foundation is important. My current main-investigation seems to turn up to dglOpenGL+nxpascal

I might use FMX 2D just for the form and buttons etc. UI, so in the future I woldnt be limited to Windows only. The rendering would be done only to one component on-screen. So far I've only managed to render to TPanel on VLC. Furthermore, nxPascal is VCL-only anyway.

SilverWarior
20-05-2017, 04:01 AM
If you have any question about LaggyLuk's voxel engine don't hesitate to ask in its thread. He is stil visiting PGD forums quite regularly and knowing him from the past I'm sure he will be prepared to help. Perhaps even help you to compile his engine with newest version of FPC/Lazarus (I don't think he is using Delphi).

Anton
31-10-2017, 01:35 PM
Hi Thyandyr,

I was confronting the same situation a while ago. I don' know if you are interested in D3D11 or D3D12.

For D3D11 you can check these few examples here - https://github.com/AntonAngeloff/DX11_Examples . I wrote them as part of a project for a basic tutorial on using Direct3D 11 with FPC/Delphi, which unfortunately I never finished. The examples are based on the CMCHTPC headers.

Thyandyr
31-10-2017, 09:00 PM
Hi Thyandyr,

I was confronting the same situation a while ago. I don' know if you are interested in D3D11 or D3D12.

For D3D11 you can check these few examples here - https://github.com/AntonAngeloff/DX11_Examples . I wrote them as part of a project for a basic tutorial on using Direct3D 11 with FPC/Delphi, which unfortunately I never finished. The examples are based on the CMCHTPC headers.

Thanks. I started with OpenGL but will definitely check these as well. I don't have any ideology, I just want something that is easy to set up.

Had a look. Looks pretty much same as OpenGL code. Unfortunately I get [dcc32 Error] renderer.pas(178): E2010 Incompatible types: 'PDXGI_SWAP_CHAIN_DESC' and 'TDXGI_SWAP_CHAIN_DESC' and I don't know what to do. Maybe the header file superseded the project files.

Anton
01-11-2017, 12:51 PM
Most likely the headers are updated and this causes the error. Could you tell me the Delphi version you are using and which particular example gives you that error? I can try to fix it.
Anyway, if this is the only error you can try to change the variable to a pointer, i.e. add @ operator in front of swapchain_desc.

Thyandyr
01-11-2017, 03:13 PM
Most likely the headers are updated and this causes the error. Could you tell me the Delphi version you are using and which particular example gives you that error? I can try to fix it.
Anyway, if this is the only error you can try to change the variable to a pointer, i.e. add @ operator in front of swapchain_desc.

Berlin 10.1

I'll try that later in the evening

Anton
01-11-2017, 08:56 PM
The same error appears in Lazarus. I fixed that and added DelphiDX12 as a submodule in the repository, which will download the headers along with the examples on one hand. And on the other hand it will bind the examples to a particular DelphiDX12 version.

It should compile successfully now, thanks for your feedback. On interest, I am able to add more examples.

Thyandyr
01-11-2017, 10:51 PM
All examples compile but when running them they ask for d3dx10d_43.dll which is not on my computer (Windows 10 64-bit)

Ok I changed target from debug to release. Now it says DX12.D3DX10 cannot be found... but it is in the headers folder. Oh had to set search path for Release. Now it is back to the exe asking for DX12.D3DX10

Akira13
01-11-2017, 11:15 PM
PXL (formerly called Asphyre Sphinx I guess) has a fully functioning DirectX11 backend (as well as DirectX7, DirectX9, legacy OpenGL, and modern OpenGL backends) that should give you a pretty good idea of how DirectX works in practice.

https://sourceforge.net/p/asphyre/code/HEAD/tree/

Also, regarding FMX: not worth anyone's time. It's just an extremely stripped down, worse version of GLScene (literally, not figuratively. The 3D parts of FMX are based entirely on DXScene by Eugene Kryukov, which was itself a not-that-great DirectX based fork of GScene. Making FMX a fork of fork!)

Anton
02-11-2017, 05:21 AM
All examples compile but when running them they ask for d3dx10d_43.dll which is not on my computer (Windows 10 64-bit)

Ok I changed target from debug to release. Now it says DX12.D3DX10 cannot be found... but it is in the headers folder. Oh had to set search path for Release. Now it is back to the exe asking for DX12.D3DX10

The file d3dx10d_43.dll should be the debug build of d3dx10_43.dll. I think you can get by installing the DirectX End-user runtime installer - https://www.microsoft.com/en-us/download/details.aspx?id=35

If you've downloaded or pulled the entire repository please note that "headers" directory is removed and the headers are now contained in "DelphiDX12\Units". Your include path should be "..\DelphiDX12\Units"