Author Topic: [C++] DXUT or not DXUT ?  (Read 3367 times)

0 Members and 1 Guest are viewing this topic.

Offline Ktulu

  • ZX 81
  • *
  • Posts: 5
  • Karma: 1
    • View Profile
[C++] DXUT or not DXUT ?
« on: December 07, 2011 »
Hi,

DirectX SDK allows two ways to create windows : classic one with WIN32 API or easy one using DXUT.
Are there any performances/features issues with one or another method ?

Regards,

Ktulu

Offline LittleWhite

  • Senior Member
  • Amiga 1200
  • ********
  • Posts: 418
  • Karma: 31
  • It's me!
    • View Profile
Re: [C++] DXUT or not DXUT ?
« Reply #1 on: December 07, 2011 »
Hey,

I did not know about DXUT. I quickly look about what it is and I will try to make you an answer (consider that I don't know DXUT).
I tries to simplify Win32 API stuff. It depends if you like to work with the Win32 API, but generally it gets quickly ugly.
As far as I know, DXUT is based more on callbacks (function which get called) than an event loop :
Code: [Select]
INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, INT )
{
    // Set Direct3D 9 callbacks
    DXUTSetCallbackD3D9DeviceAcceptable( IsD3D9DeviceAcceptable );
    DXUTSetCallbackD3D9DeviceCreated( OnD3D9CreateDevice );
    DXUTSetCallbackD3D9DeviceReset( OnD3D9ResetDevice );
    DXUTSetCallbackD3D9FrameRender( OnD3D9FrameRender );
    DXUTSetCallbackD3D9DeviceLost( OnD3D9LostDevice );
    DXUTSetCallbackD3D9DeviceDestroyed( OnD3D9DestroyDevice );
   
    // Set Direct3D 10 callbacks
    DXUTSetCallbackD3D10DeviceAcceptable( IsD3D10DeviceAcceptable );
    DXUTSetCallbackD3D10DeviceCreated( OnD3D10CreateDevice );
    DXUTSetCallbackD3D10SwapChainResized( OnD3D10ResizedSwapChain );
    DXUTSetCallbackD3D10FrameRender( OnD3D10FrameRender );
    DXUTSetCallbackD3D10SwapChainReleasing( OnD3D10ReleasingSwapChain );
    DXUTSetCallbackD3D10DeviceDestroyed( OnD3D10DestroyDevice );
   
    // Set the generic callback functions
    DXUTSetCallbackDeviceChanging( ModifyDeviceSettings );
    DXUTSetCallbackMsgProc( MsgProc );
    DXUTSetCallbackFrameMove( OnFrameMove );

    // TODO: Perform any application-level initialization here
   
    // Initialize DXUT and create the desired Win32 window and Direct3D device for the application   
    DXUTInit( true, true );
    DXUTCreateWindow( L"TestApp" );
    DXUTCreateDevice( true, 640, 480 );

    // Start the render loop
    DXUTMainLoop();

    // TODO: Perform any application-level cleanup here
   
    return DXUTGetExitCode();
}

It looks that there is no problem to use it with Dx9 and 10. So, I would say, give it a try and give us some feedback on how you like it ;)
The demoscene will never die, never!

Offline Ktulu

  • ZX 81
  • *
  • Posts: 5
  • Karma: 1
    • View Profile
Re: [C++] DXUT or not DXUT ?
« Reply #2 on: December 08, 2011 »
Hi,

Thanks for your answer. So I'm currently testing operations with DXUT. It's quite simple as it handles and simplify many things like vsync, hardware capabilities, SM choice, ...
Will try to implement simple raster operations and a mod player to see some action now :)
But more than 200 lines of C++ code just to set up the  environment, is quite disturbing compared to the dozen ones needed on my old Amiga in asm ;)

Ktulu

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17394
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: [C++] DXUT or not DXUT ?
« Reply #3 on: December 08, 2011 »
Once the setup code is done though you'll just use it again and again :)
Shockwave ^ Codigos
Challenge Trophies Won: