Jump to content
  • Advertisement

Archived

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

Random Number

Project Releasing Problems

This topic is 5299 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 am currently working on a 3d snake game maded for DirectX 9. Everything runs fine on my computer, but when I send it to some people I know it only runs correctly 1/2 the time and they all have DirectX9 b. The 1/2 that doesnt work get the "Application failed to initialize properly" error. Here is some background info and the how I compile and send the program. I use Visual C++ 7 My program uses d3d9.lib d3dx9.lib winmm.lib I compile by Re-Build All I run by using control-f5 I put these files in the zip: debug/3dsnaker.exe level.x snake.x I am new to DirectX and have never released a project. Am I doing something wrong in the way I compile the files or is there a problem with my code somewhere? Do I have to send any libraries? Really, Im stumped and frustrated! [edited by - Random Number on April 12, 2004 10:05:48 PM]

Share this post


Link to post
Share on other sites
Advertisement
different graphic cards have different capibilities, i've gotten that error too ant it basically happens when you create a device with invalid parameters...

[Edit: Spelling Errors]

[edited by - Axiverse on April 12, 2004 10:06:46 PM]

Share this post


Link to post
Share on other sites
Here is my Initialization code. Is there any way to edit this to detect what the gfx can and can not do?


bool d3d::InitD3D(
HINSTANCE hInstance,
int width, int height,
bool windowed,
D3DDEVTYPE deviceType,
IDirect3DDevice9** device)
{
//

// Create the main application window.

//


WNDCLASS wc;

wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)d3d::WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(0, IDI_APPLICATION);
wc.hCursor = LoadCursor(0, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = "Direct3D9App";

if( !RegisterClass(&wc) )
{
::MessageBox(0, "RegisterClass() - FAILED", 0, 0);
return false;
}

HWND hwnd = 0;
hwnd = ::CreateWindow("Direct3D9App", "Direct3D9App",
WS_EX_TOPMOST,
0, 0, width, height,
0 /*parent hwnd*/, 0 /* menu */, hInstance, 0 /*extra*/);

if( !hwnd )
{
::MessageBox(0, "CreateWindow() - FAILED", 0, 0);
return false;
}

::ShowWindow(hwnd, SW_SHOW);
::UpdateWindow(hwnd);

//

// Init D3D:

//


HRESULT hr = 0;

// Step 1: Create the IDirect3D9 object.


IDirect3D9* d3d9 = 0;
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);

if( !d3d9 )
{
::MessageBox(0, "Direct3DCreate9() - FAILED", 0, 0);
return false;
}

// Step 2: Check for hardware vp.


D3DCAPS9 caps;
d3d9->GetDeviceCaps(D3DADAPTER_DEFAULT, deviceType, &caps);

int vp = 0;
if( caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
vp = D3DCREATE_HARDWARE_VERTEXPROCESSING;
else
vp = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

// Step 3: Fill out the D3DPRESENT_PARAMETERS structure.


D3DPRESENT_PARAMETERS d3dpp;
d3dpp.BackBufferWidth = width;
d3dpp.BackBufferHeight = height;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
d3dpp.BackBufferCount = 1;
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp.MultiSampleQuality = 0;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = hwnd;
d3dpp.Windowed = windowed;
d3dpp.EnableAutoDepthStencil = true;
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
d3dpp.Flags = 0;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

// Step 4: Create the device.


hr = d3d9->CreateDevice(
D3DADAPTER_DEFAULT, // primary adapter

deviceType, // device type

hwnd, // window associated with device

vp, // vertex processing

&d3dpp, // present parameters

device); // return created device


if( FAILED(hr) )
{
// try again using a 16-bit depth buffer

d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

hr = d3d9->CreateDevice(
D3DADAPTER_DEFAULT,
deviceType,
hwnd,
vp,
&d3dpp,
device);

if( FAILED(hr) )
{
d3d9->Release(); // done with d3d9 object

::MessageBox(0, "CreateDevice() - FAILED", 0, 0);
return false;
}
}

d3d9->Release(); // done with d3d9 object


return true;
}


I know its a lot, but is there any thing there that can prevent this error so it dies more "gracious" and give a bit more feedback info. Or fixes the problem all together =P.


[edited by - Random Number on April 12, 2004 10:15:59 PM]

Share this post


Link to post
Share on other sites
I am taking a stab in the dark but maybe to runn it you need managed directx and the .net framework.

Share this post


Link to post
Share on other sites
quote:
Original post by Alvarny
I am taking a stab in the dark but maybe to runn it you need managed directx and the .net framework.


Nope.

I agree that you need to have it put out more feedback. There''s no ''Application failed to initialize properly'' error listed in the code you''ve shown - is it not your error, or is it in a different part of code (and if so, could you show us that part)?

Share this post


Link to post
Share on other sites
Do NOT release debug versions. You only have debug dlls if you install Visual Studio (or other compilers/IDEs probably). Always give other release versions. That''s why they called it "Release".

Set your project to "Release".
Hit Recompile all.
Give your friends release\3dsnaker.exe.

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.

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!