Jump to content
  • Advertisement

Archived

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

pajofego

Problems using Effect Files

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

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; }

Share this post


Link to post
Share on other sites
Advertisement
For starters if there is something that you need you have to ask a question.

I am not really sure what part of this code you posted that you are having a problem with.

[edited by - yzzid on May 7, 2004 1:11:47 PM]

Share this post


Link to post
Share on other sites
@yzzid, sorry. I have forget to make a question.

My problem ist the clEarthPressCoeff::RenderEarthPressCoeff() method. When i make a breakpoint to the effect file, where you can find the technique "tSetTextKx", they didn''t start it. I can''t understand why or what is to do for calling pixel shader code in effect files. For example the calling of the method in clFloatMatrix::RenderFloatTexture() works without any problems and when i put a breakpoint to the technique "tMakeTopo" it works and i can debug it. What i make wrong? Why it starts in the class clFloatMatrix and not in the class clEarthPressCoeff?

Share this post


Link to post
Share on other sites
All I can think of is that maybe the tSetTextKx technique is using a pixel shader version that is higher than the one your hardware supports. If you call SetTechnique and try to set a technique that is beyond the capabilities of your graphics card I think that will cause a problem.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!