Slowly I know how to use Revolution3D. It is just compatible with Delphi 6 and higher, FreePascal or Lazarus had not been tested, perhaps I'll do that later.
My results (after a lot of hard work ): It is possible to activate R3D via VCL or API, both ways are quite easy. And I got it to show a simple dark-blue window, which can be closed through pressing ESC key.
Here is a little code to play with (for API development):
Code:
program R3D_Initialization;
uses Windows,
SysUtils,
R3DClasses,
R3DEnum,
R3DType;
var Engine: ^TR3D_Engine;
Pipeline: ^TR3D_Pipeline;
Control: ^TR3D_Control;
bRun: Boolean = True;
iHandle: Integer;
Procedure R3DMain(hWnd: HWND);
Var bFreeMode: Boolean;
Begin
New(Engine);
New(Pipeline);
New(Control);
If MessageBox(hWnd, 'Do you want to init without the dialog?', '', mb_YesNo) = ID_YES Then bFreeMode := True Else bFreeMode := False;
If MessageBox(hWnd, 'Do you want to run this tutorial in fullscreen mode?', '', mb_YesNo) = ID_YES Then Engine.SetRenderTarget(hWnd, R3DRENDERTARGET_FULLSCREEN) Else Engine.SetRenderTarget(hWnd, R3DRENDERTARGET_WINDOW);
If Engine.InitializeMe(bFreeMode) < 0 Then Halt(0);
While bRun Do
Begin
If Control.Keyboard_GetKeyState(R3DKEY_ESCAPE) Then bRun := False;
Pipeline.Renderer_Clear;
Pipeline.Renderer_Render;
Pipeline.Renderer_Display;
End;
Engine.TerminateMe;
// Free all those pointers
Dispose(Engine);
Dispose(Pipeline);
Dispose(Control);
End;
begin
// Needed in Delphi to load Revolution3D correctly
// Exit, if libary is not loaded
If Not R3DLibLoad Then Halt(0);
// Create window and set handle to Revolution3D
iHandle := R3DWindowCreate('Revolution3D Initialization', 0, 0, 640, 480, False);
R3DMain(iHandle);
// Needed in Delphi to unload Revolution3D correctly
R3DLibUnLoad;
end.
I think I will soon add a simple tutorial on my homepage.
Bookmarks