Problem with D3DX...

Started by
17 comments, last by Matthew02 23 years, 9 months ago
Okay, this is ridiculous. I have simplified this as much as possible. Here's the important part of the source. Does anyone see anything wrong with it?

        LPD3DXCONTEXT		D3DXContext = NULL;......int PASCALWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){	fError = fopen("Error.log", "w");		// Open file for logging errors.	HRESULT		hr;	hr = D3DXInitialize();	if ( FAILED(hr) ) 	LogError(hr);// Set up and register the window class.	WNDCLASS	wc = {0};	wc.lpfnWndProc = (WNDPROC) WindowProc;	wc.hInstance = hInstance;	wc.hCursor = LoadCursor(NULL, IDC_ARROW);	wc.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);	wc.lpszClassName = NAME;	RegisterClass(&wc);// Create the window.	HWND hwnd;	hwnd = CreateWindow(NAME, TITLE, WS_POPUP, 0, 0, 800, 600,		(HWND) NULL, (HMENU) NULL, hInstance, NULL);	SetCursor(false);	// Hide the cursor.	ShowWindow(hwnd, SW_SHOWNORMAL);	// Display the window.	UpdateWindow(hwnd);// Create the D3DX context	hr = D3DXCreateContext(D3DX_DEFAULT, D3DX_CONTEXT_FULLSCREEN, hwnd,		800, 600, &D3DXContext);	if ( FAILED(hr) )	LogError(hr);        


What in the world is going on? I am still getting a DDERR_CANNOTATTACHSURFACE error and D3DXContext remains NULL after the call. I am linking with DDGUID.LIB, DDRAW.LIB, D3DIM.LIB, D3DXD.LIB, and DINPUT.LIB. I have all of the appropriate headers included. All of the SDK examples and all of the tutorials from the web work correctly. Why not this? BTW, I've tried linking with the retail version of the D3DX library also. It didn't work. I've also tried about evey possible combination of parameters with both D3DXCreateContext() and D3DXCreateContextEx() as well as many different CreateWindow() params, and I can't figure it out.


Edited by - Matthew02 on July 13, 2000 11:32:50 PM
Advertisement
This may be a typo, but you link to "d3dx.lib" not "D3DXD.LIB"

+AA_970+
Also, i don''t think you have to link to D3DIM.LIB when you used D3DX.




+AA_970+
I am linking with d3dxd.lib which is the debug version of the library. I have tried d3dx.lib (retail version) though, and it didn't make any difference. And when I took out d3dim.lib, the program linked fine, but still gives the same error. This is the most stubborn problem... Thanks for all the help though. With hope, I'll figure the damned thing out. Anyway, if you think of anything else...

Edited by - Matthew02 on July 14, 2000 10:45:23 PM
This is really strange, anyway, i compiled the source code you posted and started up my game with it and it gave no problems.

+AA_970+
This sounds very much like bug in either D3DX or in 3Dfx''s drivers. I think you are going to have to accept that and switch back to using D3DIM for the initialization instead.

- WitchLord

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Are you using the latest Voodoo 3 drivers (1.05.00)?
Because my comp. has problems with the new drivers i''m using the 1.04.00, but i did try out the 1.05.00 drivers. Both drivers worked fine with D3D apps and D3DX. If your using the drivers off the cd you may need to download one of these drivers.

+AA_970+
Sorry about not replying. I've been away for a couple of days. Anyway...
I'm downloading the newest drivers right now and I'll check those out. As for going back to d3dim, I may do that anyway, but I wish that I could understand what is going on here. Witchlord, you say you believe it could be a problem with d3dx or 3dfx, but explain this... All of the SDK examples compile and run correctly as do all of the internet tutorials that I've found thus far. I have even created a new project and just pasted in some code from a tutorial page (as opposed to downloading their project) and it worked fine.
The only place where d3dx doesn't work is in my project. This leads me to believe that there is a problem with my code, but +AA_970+ says the same code works fine on his computer. *shrugs*
You see... This is very strange.
I'm going to try with the new drivers *crosses fingers* and if that doesn't work, maybe I'll look for a MS e-mail where I can get some DirectX support. I doubt that I'll get a response from them, but it's sure worth a try. In the meantime, if you folks think of anything else, please let me know. I'm anxious to figure out what's I have done wrong (if anything).
Thanks again for all of your responses. I can't express how much I appreciate everyone taking their time to help me out.

Edited by - Matthew02 on July 18, 2000 11:57:23 PM
Well, I installed updated drives for my Voodoo and guess what? It worked. Haha. That's funny. My whole problem has been drivers. *kicks self in head*
Thanks to everyone who replied. I really appreciate all of your help. There's just one lingering question... Why did the SDK examples work with the old drivers? Hmm...
Well, actually two lingering questions. If I use d3dx rather than d3dim, is it going to severely limit my audience? With the driver problem that I had, I am somewhat afraid to use d3dx. Are there d3d compatible devices which do not work with d3dx? I thought it worked on top of d3d and ddraw (just a helper library). Why would d3dim and ddraw work, but not d3dx?
Doh, that was more than two questions. Oh well... Anyway, thanks again.

Edited by - Matthew02 on July 24, 2000 12:42:19 AM

This topic is closed to new replies.

Advertisement