Original Post
Hi,
i have write two classes (clEarthPressCoeff and clFloatMatrix )to access two Effect Files. Although both are similar, the class clFloatMatrix does not call the
Pixelshader code in the Effect File. But the class clEarthPressCoeff does it. I will post here the interesting part of my code if you need more the tell me please. For ideas I would be very grateful. Thanks pajofego
// class clEarthPressCoeff
HRESULT clEarthPressCoeff::RenderEarthPressCoeff()
{
HRESULT hr;
UINT cPasses;
D3DXVECTOR4 fVector4 = D3DXVECTOR4(GetKxa(), GetKxp(), 0.0f, 0.0f);
// Beschreiben der Kx Texture -> 2 Einträge
CHECK_HR(m_CoeffRenderSurface->BeginScene(m_CoeffTextureSurface[0], NULL));
CHECK_HR(ms_pShaderClCoeff->SetTechnique("tSetTextKx"));
CHECK_HR(ms_pShaderClCoeff->SetVector("Kx", &fVector4));
CHECK_HR(ms_pShaderClCoeff->Begin(&cPasses, 0));
CHECK_HR(m_pd3dDevice->SetStreamSource( 0, ms_pVertClCoeff, 0, sizeof(BASISVERTEX)));
CHECK_HR(m_pd3dDevice->SetFVF( BASISVERTEX::FVF ));
CHECK_HR(m_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2));
CHECK_HR(ms_pShaderClCoeff->End());
CHECK_HR(m_CoeffRenderSurface->EndScene(0));
fVector4 = D3DXVECTOR4(GetKya(GetKxa()), GetKya(GetKxp()), GetKyp(GetKxa()), GetKyp(GetKxp()));
CHECK_HR(m_CoeffRenderSurface->BeginScene(m_CoeffTextureSurface[1], NULL));
CHECK_HR(ms_pShaderClCoeff->SetTechnique("tSetTextKy"));
CHECK_HR(ms_pShaderClCoeff->Begin(&cPasses, 0));
CHECK_HR(ms_pShaderClCoeff->SetVector("Ky", &fVector4));
CHECK_HR(m_pd3dDevice->SetStreamSource( 0, ms_pVertClCoeff, 0, sizeof(BASISVERTEX)));
CHECK_HR(m_pd3dDevice->SetFVF( BASISVERTEX::FVF ));
CHECK_HR(m_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2));
CHECK_HR(ms_pShaderClCoeff->End());
CHECK_HR(m_CoeffRenderSurface->EndScene(0));
return S_OK;;
}
// class clFloatMatrix
HRESULT clFloatMatrix::RenderFloatTexture()
{
HRESULT hr = S_OK;
UINT cPasses;
D3DXVECTOR4 fVector4 = D3DXVECTOR4(40.0f / 180.0f * M_PI, 0.0f, 0.0f, 0.0f);
hr = m_lpBufferRenderSurface->BeginScene(m_lpBufferTextureSurface, NULL);
hr = ms_pShaderClFloat->SetTechnique("tMakeTopo");
hr = ms_pShaderClFloat->SetVector("Zeta0", &fVector4);
hr = ms_pShaderClFloat->Begin(&cPasses, 0);
hr = ms_pShaderClFloat->Pass(0);
hr = m_pd3dDevice->SetStreamSource( 0, ms_pVertQuad, 0, sizeof(VERTEX) );
hr = m_pd3dDevice->SetFVF( VERTEX::FVF );
hr = m_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2); // D3DPT_TRIANGLESTRIP
hr = ms_pShaderClFloat->End();
hr = m_lpBufferRenderSurface->EndScene(0);
return hr;
}
// class CMyD3DApplication
HRESULT CMyD3DApplication::Render()
{
m_EarthPressCoeff->RenderEarthPressCoeff(); // this here will not calls the effect file
//m_floatMatrix->RenderFloatTexture();// this here works
// Begin the scene
if( SUCCEEDED( m_pd3dDevice->BeginScene() ) )
{
// Clear the viewport
m_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_RGBA(127, 127, 255, 0), 1.0f, 0L );
// TODO: render world
//m_pd3dDevice->SetTexture( 0, m_floatMatrix->m_lpBufferTexture); // this here works
m_pd3dDevice->SetTexture( 0, m_EarthPressCoeff->GetKxTexture()); // this here will not calls the effect file
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
//m_pd3dDevice->SetStreamSource(0, m_floatMatrix->ms_pVertQuad, 0, sizeof(VERTEX)); // this here works
m_pd3dDevice->SetStreamSource(0, m_EarthPressCoeff->ms_pVertClCoeff,0 , sizeof(BASISVERTEX)); // this here will not calls the effect file
m_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2); //D3DPT_TRIANGLEFAN // D3DPT_TRIANGLESTRIP
// Render stats and help text
RenderText();
// End the scene.
m_pd3dDevice->EndScene();
}
return S_OK;
}