Sign in to follow this  

Running Slow when Compiled in Visual Studio .NET 2003

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

I tried to compile the third of Andy Pike's DirectX Tutorials (A spinning cube colored by vertex colors), and I'm getting about 5 frames a second. I ran other similar applications that I had compiled in Microsoft VC++ 6.0 on another machine, and they ran fine. I tried switching to release mode, but this had no effect. Any idea why this might be?

Share this post


Link to post
Share on other sites
Here is what I am using to setup my device, It looks to me like I am using HAL...

HRESULT InitialiseD3D(HWND hWnd)
{
g_pD3D = Direct3DCreate8(D3D_SDK_VERSION);

if(g_pD3D == NULL)
{
return E_FAIL;
}

D3DDISPLAYMODE d3ddm;
if(FAILED(g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm)))
{
return E_FAIL;
}

D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));

d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
d3dpp.BackBufferFormat = d3ddm.Format;

if(FAILED(g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &g_pD3DDevice)))
{
return E_FAIL;
}

g_pD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
g_pD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);

return S_OK;
}

Share this post


Link to post
Share on other sites
g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &g_pD3DDevice)

Maybe you want to specify
D3DCREATE_HARDWARE_VERTEXPROCESSING
instead of
D3DCREATE_SOFTWARE_VERTEXPROCESSING.

Share this post


Link to post
Share on other sites
nmi - I tried what you said, and to no avail. When I use Hardware rather than software, the window doesn't even open and my program does nothing.

eq - How would I go about doing that?

thanks to both of you!

Share this post


Link to post
Share on other sites
That looks fine to me... I haven't worked with the vsync swapeffect yet-- but I would imagine it works as advertised ;)

Have you actually tried compiling this demo in MSVC6, just for giggles? Otherwise, it might be something somewhere else... what you posted looks just fine.

-dbh

Share this post


Link to post
Share on other sites
You haven't by any chance got 'Use Managed Extensions' set to yes have you? I have seen people working away quite happily not realising this is ticked and then wondering about the long start up times etc.

Share this post


Link to post
Share on other sites
I had the same problem a couple of days ago because both my release and debug version was linking to the debug version of libc (there is a new tab somewhere on VC 7 for this). Check if you link with the good lib (LIBCMT.lib or LIBCMT.lib, not Libcd.lib or licmtd.lib).

ptl

Share this post


Link to post
Share on other sites

This topic is 4586 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this