Direct3D simplifier (easy as OpenGL) for Delphi

Started by
5 comments, last by tmtlib2010 13 years, 9 months ago
Hello! I release my new simple program demonstrating D3D usage in Delphi.
Now you can use DirectX programs like that:
dxuLookAt(0, 0, 30,5, 0, 00, 0, 1, 0);
dxBindTexture(DX_TEXTURE_2D, texid_dx);
dxPushMatrix;
dxRotatef(180,1,0,0);
dxTranslatef(0,-10,0);
dxBegin(dx_TRIANGLES);
dxTexCoord2f(0,0);
dxVertex3f(0,0,0); ... etc.
It is first release of OpenGL to Direct3D wrapper. We can improve it together. Btw, it usable already!

OpenGL to Direct3D wrapper made with Delphi
(This program demonstrates OGL vs D3D rendering difference).

v0.1 features list:
- dxRotatef
- dxTranslatef
- dxuLookAt
- dxMatrixMode
- dxLoadIdentity
- dxuPerspective
- dxClearColor
- dxClear
- dxDisable
- dxEnable
- dxBegin
- dxTexCoord2f
- dxVertex3f
- dxEnd
- dxPushMatrix
- dxPopMatrix
- dxBindTexture

Download source code and EXE demo: opengl_to_directx_01.zip (300kb)

new versions at igrodel.ru
p.s. And it does NOT require D3DX.DLL =)
Advertisement
I really like the idea. When choosing between DirectX and OpenGL, I've always decided to use OpenGL so far. The main reason was not platform independency or something like that - it was the plain look of OpenGL code compared to its nasty DirectX equivalent.

Though, Delphi isn't of any interest for me. If its a .dll library I can link with any language, I'm really looking forward to it. Hope, the overhead isn't too high there.
making dll is a good idea. Main problem is about limitations. For example opengl extensions is difficult to implement in full amout. opengl 1.0, vertex arrays and multi texturing can be made without any problems. More advanced things like shader support and directx specific extension better implement in opengl style, but not compatible with GL specifications. Maybe =) Hope this code will help learn some D3D. Thank for feedback.
I don't think you should be aiming to do a 100% OpenGL-Equivalent wrapper. For performance and structure issues it might be best to abandon full compatibility right from the beginning. Better focus on "making it as similar as possible" but without forcing it to be exactly the same. If you'll have to generate huge amounts of internal management code to wrap Dx functionality to OpenGL, it might turn out bad for performance and stability. In those cases, it might be better to mimic the OpenGL style but not its functionality. However, 1:1 is great in areas where it's possible!
I asked some questions on other forums and decided to implement OpenGL VBO through D3D. If anyone have suggestions about that please let me know.
There is very similar project already from Google: ANGLE.
Although it doesn't use OpenGL API, it uses OpenGL ES 2.0 API (very similar to GL 2.x). If you can find GL ES API headers for Delphi, then you can already use ANGLE project. It supports even shader translation from hlsl to glsl (ES set).
thank you very much! i will review it, although never before used opengl es. hope it is similar

This topic is closed to new replies.

Advertisement