Materials have no effect...???
From: Morten Aune Lyrstad (too_at_much.spam)
Date: 07/21/04
- Next message: Morten Aune Lyrstad: "Re: Detecting MultiSampling override"
- Previous message: Callum Winter: "Re: newbie: rotating meshes"
- Next in thread: Morten Aune Lyrstad: "Update: Materials have no effect...???"
- Reply: Morten Aune Lyrstad: "Update: Materials have no effect...???"
- Reply: Morten Aune Lyrstad: "Update: Materials have no effect...???"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 21 Jul 2004 18:35:26 +0200
Hi there!
Anyone experienced that the material definitions have no effect on the
color?
Here's my code: (Very unoptimized, I know... ;-)
----------------------------------------------------------------------------
------------------------------------------------------------------------
INT i;
DWORD lightState;
D3DMATERIAL9 sketchMat;
// Set render states for this canvas
global.device->GetRenderState(D3DRS_LIGHTING, &lightState);
if (lightState)
global.device->SetRenderState(D3DRS_LIGHTING, FALSE);
global.device->SetRenderState(D3DRS_COLORVERTEX, FALSE);
global.device->SetTexture(0, NULL);
global.device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
global.device->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
sketchMat.Emissive = D3DXCOLOR(0x00000000UL);
sketchMat.Specular = sketchMat.Emissive;
sketchMat.Power = 0;
sketchMat.Ambient =
D3DXCOLOR(global.constructor->GetColorSet()->GetSketchFaceColor());
// (Would return 0xFFB0B0B0)
sketchMat.Diffuse = sketchMat.Ambient;
global.device->SetMaterial(&sketchMat);
// Renders various scene elements, usually a collection of D3DXMeshes. The
flag indicates that no materials should be uploaded to the device.
for (i = 0; i < prv->sceneItems->size(); i++)
prv->sceneItems->at(i)->Render(RENDER_OVERRIDE);
// Restore render states
global.device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
global.device->SetRenderState(D3DRS_COLORVERTEX, TRUE);
if (lightState)
global.device->SetRenderState(D3DRS_LIGHTING, TRUE);
----------------------------------------------------------------------------
------------------------------------------------------------------------
Everything comes out white.
DirectX9 MSDEV60
Yours,
Morten Aune Lyrstad
- Next message: Morten Aune Lyrstad: "Re: Detecting MultiSampling override"
- Previous message: Callum Winter: "Re: newbie: rotating meshes"
- Next in thread: Morten Aune Lyrstad: "Update: Materials have no effect...???"
- Reply: Morten Aune Lyrstad: "Update: Materials have no effect...???"
- Reply: Morten Aune Lyrstad: "Update: Materials have no effect...???"
- Messages sorted by: [ date ] [ thread ]