Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


D3DX 8 -- Is it worth using?

This topic is 6592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I''d like to hear your opinion on this: I started coding my engine in DX7, and I firmly abstained from using the Framework library. I thought it would be slow, and so I coded all the stuff I needed myself. Basically, I thought I couldn''t fully optimize my engine if I used the Framwork library. Now I''m converting my app to DX8, and it seems that Microsoft is really pushing me to use D3DX. I mean, it''s not fully documented in their SDK, and I can''t find some of the documentation needed to do stuff WITHOUT D3DX... And all the samples use it... What should I do? Is it worth using? Are you all using it? It seems that loading .X files will be a lot easier (if I use D3DX) than loading some other format. Back then I thought of using .3DS or something, but I''m not so sure now. Please let me know what you think, guys I''m the crazy DuSiK! I eat Microshaft for breakfast

Share this post

Link to post
Share on other sites
Your app will run fine in d3d8 by simply doing this:

if( NULL == ( m_pD3D = Direct3DCreate8( D3D_SDK_VERSION ) ) )
MessageBox(NULL,"Cannont create D3D!","Error",MB_OK);
return E_FAIL;

if( FAILED(hr = m_pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm ) ) )
return hr;

// Set present parameters

ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = true;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

// Create the D3DDevice

if( FAILED(hr = m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hwnd,
&d3dpp, &m_pD3DDevice ) ) )
MessageBox(NULL,"Failed to create device!","Error",MB_OK);
return hr;

m_pD3DDevice->SetRenderState( D3DRS_ZENABLE, TRUE );

Yes! thats just about all you need (simple, aint it?)

The only things that is actually NEEDED from D3dx is the math functions, unless you want to write your own (im assuming you have your own already though).

Important things to remember though:

- DrawPrimitiv() Only works with Vertex buffers. For your own arrays, use DrawPrimitiveUP().

-D3DVERTEX,D3DLITVERTEX,Etc. are not in there. you must make your own vertex structures (you can use either vertex shaders or simply a #define with the Flexible vertex format flags for the format).

-You must call:
And finally:
in order to render. It is a bit more complex with the 2 extra steps, but the flexability afforded is awesome (not to mention the possibility of multiple stream sources).

-LPDIRECTDRAWSURFACE7 ->-> LPDIRECT3DTEXTURE8 (for all practical purposes).

-D3DRENDERSTATE_blahblahblah ->-> D3DRS_blahblahblah.(also, D3DTS_blah).

Nice and easy!

BTW, the x file format is real easy to use with d3dx -- I wouldn't be surprised to see it in a game here pretty soon.

The reason for the D3DX pushing thing is that MS uses it as their framework now(replacing most of the D3DFrameWork files) in order to avoid the confusion that many had with the choice of the D3DX Libraries or the D3DFramework in DX7.

Oh yeah almost forgot -- The function d3dDevice->Present(); replaces the former need to differentiate between fullscreen and windowed mode in your code. Just call Present() each frame =)


Sometimes I think I know what I really don't, but then again usually I do know what I don't, but just don't realize it, maybe its because I am so young, but then again it could be because I am insane.

Edited by - Etnu on November 28, 2000 11:41:30 PM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!