m_pD3DDevice->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE);
See if that does it for ya. Otherwise I'd check to make sure your D3DTextr_GetSurface is returning something.
m_pD3DDevice->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE);
See if that does it for ya. Otherwise I'd check to make sure your D3DTextr_GetSurface is returning something.
I rewrote the Trivial Win example from MS using a skeleton MFC framework and the new D3DX texturing utils and got the plain triangle working. All attempts to texture the triangle are failing (the triangle remains a plain black). The vertices are pretty simple:
D3DVECTOR p1 = MakeVector (0.0f, 3.0f, 2.0f);
D3DVECTOR p2 = MakeVector (3.0f,-3.0f, 2.0f);
D3DVECTOR p3 = MakeVector (-3.0f,-3.0f,2.0f);
D3DVECTOR normal = MakeVector (0.0f, 0.0f, 1.0f);
//set the vertices
m_vindex [0] = MakeVertex (p1, normal, 0,0);
m_vindex [1] = MakeVertex (p2, normal, 1,0);
m_vindex [2] = MakeVertex (p3, normal, 0,1);
I set up the texture params with the following:
//load the desired texture
hr = D3DTextr_CreateTextureFromFile ("grass.bmp");
//init the texture engine states
hr = D3DTextr_RestoreAllTextures( m_pd3dev );
//bilinear texturing mode
hr = m_pd3dev->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTFN_LINEAR );
hr = m_pd3dev->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTFG_LINEAR );
hr = m_pd3dev->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
hr = m_pd3dev->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
hr = m_pd3dev->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
Finally the triangle is rendered with the following piece of code:
r = m_pd3dev->BeginScene();
if (SUCCEEDED (r)) {
//progress with the frame
//clear the target
m_pd3dx->Clear (D3DCLEAR_TARGET |D3DCLEAR_ZBUFFER);
//init the texture
m_pd3dev->SetTexture( 0, D3DTextr_GetSurface("grass.bmp") );
m_pd3dev->SetRenderState( D3DRENDERSTATE_TEXTUREPERSPECTIVE, TRUE );
//draw the primitive
m_pd3dev->DrawPrimitive (D3DPT_TRIANGLELIST, D3DFVF_VERTEX, m_vindex, 3, NULL);
//close it up
m_pd3dev->EndScene();
}
Any thoughts on what I might be missing would be greatly appreciated and thanks in advance for any help.
Sieggy