Jump to content

  • Log In with Google      Sign In   
  • Create Account


how do you setup direct3d version 7


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 awigga   Members   -  Reputation: 114

Like
Likes
Like

Posted 23 April 2000 - 01:33 PM

How do you setup direct3d version 7? i just need code with comments. so please help Styles

Sponsor:

#2 AnalGoat   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 April 2000 - 03:33 PM

Did you know that you''re kinda posting in an OpenGL section? Doesnt'' really matter though, read the documentation that comes with DirectX7 SDK, it''s really helpful and actually contains some pretty good tutorials. You do have to know how to use DirectDraw first though, but if you''re going to tangle with Direct3D you should know DirectDraw anyways! All the microsoft demo-code is commented and pretty well explained in the tutorials. Cheers!

#3 ga   Members   -  Reputation: 126

Like
Likes
Like

Posted 23 April 2000 - 10:31 PM

OpenGL is much better! *g*

Visit our homepage: www.rarebyte.de.st

GA

#4 Andreas Jonsson   Moderators   -  Reputation: 3227

Like
Likes
Like

Posted 24 April 2000 - 04:43 AM

This really isn''t the right place for DirectX questions but since I know a real easy way to set up Direct3D, which I wish to share with the OpenGL people who say that Direct3D is hard to initialize I will tell you. (Please I''m not flaming anyone and I''m not saying that Direct3D is better than OpenGL, just that it is a lot easier to work with now than with previous versions )

Initialization of Direct3D, the easy way:


HRESULT CD3DApp::InitializeD3D()
{
// Initialize D3DX
HRESULT hr;
if( FAILED(hr = D3DXInitialize()) )
return hr;


// Create the D3DX context
// D3DX creates everything we need here
DWORD Flags = m_bFullscreen ? D3DX_CONTEXT_FULLSCREEN : 0;
hr = D3DXCreateContextEx( D3DX_DEFAULT, // Use the best acceleration
Flags,
m_hWnd,
NULL, // We don''t use a parent window
m_nColorBits,
m_nAlphaBits,
m_nDepthBits,
m_nStencilBits,
D3DX_DEFAULT, // Use one backbuffer
m_nWidth,
m_nHeight,
D3DX_DEFAULT, // Let D3DX choose refreshrate
&m_pD3DX );
if( FAILED(hr) )
return hr;


// Get a reference to Direct3DDevice
m_pD3DDev = m_pD3DX->GetD3DDevice();
if( m_pD3DDev == NULL )
return E_FAIL;


// Get a reference to DirectDraw
m_pDD = m_pD3DX->GetDD();
if( m_pDD == NULL )
return E_FAIL;


return S_OK;
}


And when you shut down the application you shut down Direct3D this way:


HRESULT CD3DApp::TerminateD3D()
{
// Release our DirectX objects
if( m_pDD )
{
m_pDD->Release();
m_pDD = 0;
}


if( m_pD3DDev )
{
m_pD3DDev->Release();
m_pD3DDev = 0;
}


if( m_pD3DX )
{
m_pD3DX->Release();
m_pD3DX = 0;
}


// Let D3DX do some final uninitializations
D3DXUninitialize();


return S_OK;
}


These functions are taken directly from my own little framework so all the variables that start with m_ is declared and initialized somewhere else, but I think you can figure out what they do.

The D3DXCreateContextEx() function has a little brother called D3DXCreateContext() that has less parameters, so it can be easier to use if you don''t need the extra features.


- WitchLord

#5 AnalGoat   Members   -  Reputation: 122

Like
Likes
Like

Posted 24 April 2000 - 04:57 AM

Since NeHe''s area is now an OpenGL type area, maybe someone should volunteer to moderate a DirectX section, just an idea.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS