Jump to content
  • Advertisement
Sign in to follow this  
Tingle

Getting a D3D App to work on a differnt PC

This topic is 2996 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

Im trying to get my APP to run on my brothers computer. It works fine on mine, but on his it fails creating the D3D device with a D3DERR_INVALIDCALL error.

This is the device code:


m_pD3D = Direct3DCreate9( D3D_SDK_VERSION );

DWORD *MSQuality = NULL;
m_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_NONMASKABLE, MSQuality);
int MSQ = sizeof( MSQuality ) - 1;

ZeroMemory( &m_D3Dpp, sizeof( m_D3Dpp ) );
m_D3Dpp.Windowed = TRUE;
m_D3Dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_D3Dpp.MultiSampleType = D3DMULTISAMPLE_NONMASKABLE;
m_D3Dpp.MultiSampleQuality = MSQ;
m_D3Dpp.hDeviceWindow = hWnd;
m_D3Dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
m_D3Dpp.BackBufferWidth = g_pOrb->m_nScreenWidth;
m_D3Dpp.BackBufferHeight = g_pOrb->m_nScreenHeight;
m_D3Dpp.EnableAutoDepthStencil = TRUE;
m_D3Dpp.AutoDepthStencilFormat = D3DFMT_D16;

HRESULT hr;
hr = m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &m_D3Dpp, &m_pD3DDevice );

MessageBox(NULL, DXGetErrorString(hr), L"STATUS", MB_ICONERROR | MB_OK);



now im running a Geforce 260GTX and he has a Radeon X1300/X1550 Series.

His drivers are up to date. And considering im setting the multisampling quality based off what his drivers support, I dont see where the problem is.

Share this post


Link to post
Share on other sites
Advertisement
These lines look a little iffy:
DWORD *MSQuality = NULL;
...
int MSQ = sizeof( MSQuality ) - 1;
...
m_D3Dpp.MultiSampleQuality = MSQ;

Based on this, your multisample quality is always going to be 3.

Share this post


Link to post
Share on other sites
Your right that was the problem, I disabled multisampling and it worked, but the msdn says that it returns a value of the MS quality. So how can I get the return value, its a DWORD pointer. pDword[0] wont do it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Tingle
Your right that was the problem, I disabled multisampling and it worked, but the msdn says that it returns a value of the MS quality. So how can I get the return value, its a DWORD pointer. pDword[0] wont do it.
That's because you need to pass in the DWORD to get populated with data, the MSDN says "This can be NULL if it is not necessary to return the quality levels", and you're passing NULL indirectly (MSQuality = NULL).

DWORD MSQuality = 0;
m_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_NONMASKABLE, &MSQuality);
int MSQ = MSQuality - 1;


Share this post


Link to post
Share on other sites
Not sure why it wont,

"pQualityLevels returns the number of device-specific sampling variations available with the given sample type. For example, if the returned value is 3, then quality levels 0, 1 and 2 can be used when creating resources with the given sample count."

So if my MSQuality is a 3, i do -1 to get the max quality.

But it crashes if I do this. Doesnt even get to the part of the code for HR.


DWORD *MSQuality = NULL;
m_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_NONMASKABLE, MSQuality);

ZeroMemory( &m_D3Dpp, sizeof( m_D3Dpp ) );
m_D3Dpp.Windowed = TRUE;
m_D3Dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_D3Dpp.MultiSampleType = D3DMULTISAMPLE_NONMASKABLE;
m_D3Dpp.MultiSampleQuality = (*MSQuality - 1);
m_D3Dpp.hDeviceWindow = hWnd;
m_D3Dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
m_D3Dpp.BackBufferWidth = g_pOrb->m_nScreenWidth;
m_D3Dpp.BackBufferHeight = g_pOrb->m_nScreenHeight;
m_D3Dpp.EnableAutoDepthStencil = TRUE;
m_D3Dpp.AutoDepthStencilFormat = D3DFMT_D16;

HRESULT hr;
hr = m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &m_D3Dpp, &m_pD3DDevice );

MessageBox(NULL, DXGetErrorString(hr), L"STATUS", MB_ICONERROR | MB_OK);


Share this post


Link to post
Share on other sites
While im at it. How can I set the optacy of the model/texture/material/what ever?

Im try todo a blur effect, so im rendering the model again with a slightly bigger scale, and then I need to set the opacity down. Sorta like Id do it in photoshop.


Edit:
or actualy, no I dont think this method works proper. I just retested in photoshop, what I do there is copy the image, apply the gaussian blur and then scale the transparency down.

Would I do the same in D3D? And if yes, how. And do I need to use HLSL/shader or can I do it purley with rendering.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!