Archived

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

I'm having quite a queer quandary with a D3DX interface

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

Sorry for the title (I feel like a newbie again! This is so exciting!) Anyway, getting serious. I''m having a problem (duh). I created one of those D3DX context thingies and in my InitDX() function, I call SetClearColor() and get the D3D interfaces from it, with no problems. Then, in my central rendering function, any attempt to make a call from the interface result in the abrupt termination of the progam. Upon checking the error log, I found that the methods never even returned. I was using the context to clear the screen (which caused a crash), but I switched to calling Clear from the D3D device and it stopped quitting there and started quitting on the next call from the context: UpdateFrame(). The interface isn''t NULL; I checked that, and I couldn''t have released it anywhere. The one place I do release interfaces has calls to my logger, and they don''t show up anywhere in the log file. I hope my problem is clear (and hopefully straightforward to solve?). This problem just seemed to pop up out of nowhere. One compile, it was working, and the next compile (after a few minor changes), it failed. The D3DX examples with the SDK work. Please help, as this problem is baffling me. Trigon I like food.

Share this post


Link to post
Share on other sites
I learned D3D from your tutorials.

This problem is still bugging me, even after checking over all the resources I could find. I''ll check MSKB in a sec, that just came to me, but I don''t know what I''m doing to upset the works here. Well, thanks anyway.

I like food.

Share this post


Link to post
Share on other sites
One thing: did you remember to call D3DXInitialize() before you created the context?

----------------------------------------
Whenever I see an old lady slip and fall on a wet sidewalk, my first instinct is to laugh. But then I think, what if I was an ant and she fell on me? Then it wouldn't seem quite so funny.

Share this post


Link to post
Share on other sites
Yes of course, none of the D3DX functions work w/o D3DXInitiliaze first.

Okay.. here 'tis.
            
void InitDX()
{
hr = D3DXInitialize();
D3DXGetErrorString(hr, 80, szError);
LogHRESULT(hr, LOG_BOTH | QUIT_ON_FAIL, "Initialized D3DX.", szError);


hr = D3DXCreateContext(D3DX_DEFAULT,
D3DX_CONTEXT_FULLSCREEN,
Windows->GetHWND(),
800, 600,
&lpD3DXContext);
D3DXGetErrorString(hr, 80, szError);
LogHRESULT(hr, LOG_BOTH | QUIT_ON_FAIL, "Created D3DX context.", szError);


lpD3DDevice = lpD3DXContext->GetD3DDevice();
lpD3D = lpD3DXContext->GetD3D();
lpDD = lpD3DXContext->GetDD();
Log("Got interfaces.");


hr = lpD3DXContext->SetClearColor(D3DRGBA(0.0f, 0.0f, 0.3f, 0.0f));
D3DXGetErrorString(hr, 80, szError);
LogHRESULT(hr, LOG_BOTH | QUIT_ON_FAIL, "Set clear color.", szError);


D3DMATRIX ViewMat;
D3DUtil_SetViewMatrix(ViewMat, D3DVECTOR(0,0,-5), D3DVECTOR(0, 0, 0), D3DVECTOR(0,1,0));
hr = lpD3DDevice->SetTransform(D3DTRANSFORMSTATE_VIEW, &ViewMat);
D3DXGetErrorString(hr, 80, szError);
LogHRESULT(hr, LOG_BOTH | QUIT_ON_FAIL, "Set view transform.", szError);
}



I hope that makes sense, though I've probably commited one of my biggest pet peeves - making it so you have to scroll horizontally to see the message. No worries!

BTW, if you're a fan of RPGs at all, check out Plansecape: Torment if you haven't already - I HIGHLY recommend it.

Trigon

I like food.

Edited by - TrigonLoki on July 14, 2000 2:06:43 AM

Edited by - TrigonLoki on July 14, 2000 2:09:09 AM

Edited by - TrigonLoki on July 14, 2000 2:09:49 AM

Share this post


Link to post
Share on other sites