Jump to content
  • Advertisement
Sign in to follow this  
1v1

Problem about DolphinVS of DX 9.0

This topic is 3446 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'm a newbie of game programming and i'm learning DX SDK recently . here is my problem, i want to add a quad with texture to this demo . so i code these in the Render() function: //---------------* test of surface with some texture . *------------ SetupMatrices(); //world view proj Matrices m_pd3dDevice->SetTexture( 0, g_pTestTexture ); m_pd3dDevice->SetFVF(D3DFVF_CUSTOMVERTEX); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); // draw our quad m_pd3dDevice->SetStreamSource(0, g_pVB, 0, sizeof(D3DFVF_CUSTOMVERTEX)); m_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2); //---------------* end of test *--------------- but i got nothing change on the screen... then i add this after SetFVF(): m_pd3dDevice->SetVertexShader( 0 ); i can see a black line gleamingly . here is my CUSTOMVERTEX: //---------------* test of surface with some texture . *------------ struct CUSTOMVERTEX { D3DXVECTOR3 position; // The position D3DCOLOR color; // The color FLOAT tu, tv; // The texture coordinates }; #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1) and initialization of vertex : // Create the vertex buffer. if( FAILED( m_pd3dDevice->CreateVertexBuffer( 6*2*sizeof(CUSTOMVERTEX), D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED, &g_pVB, NULL ) ) ) { return E_FAIL; } CUSTOMVERTEX* pVertices; if( FAILED( g_pVB->Lock( 0, 0, (void**)&pVertices, 0 ) ) ) return E_FAIL; pVertices[0].position = D3DXVECTOR3(-8.0f, -8.0f, 0.0f); pVertices[0].color = 0xffffffff; pVertices[0].tu = 0.0f; pVertices[0].tv = 0.0f; ...... //followed by other five Vertex init //---------------* end of test *--------------- i have try my best and just can't figure out what's the problem.. please help me ...

Share this post


Link to post
Share on other sites
Advertisement
You should disable lighting: SetRenderState(D3DRS_LIGHTING, false)

Disable the pixel shader: SetPixelShader(0)

Setup a valid texture pipeline: Any stage with a colorop needs an alphaop (and args). Disable is invalid for stage 0's alphaop. Set stage 1's colorop (and alphaop preferably) to disable.

Share this post


Link to post
Share on other sites
to Namethatnobodyelsetook:

Thanks for your reply and i do as you say just now.

after i do this :
// Turn off culling
m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );

i can see half of the quad now(a black triangle) . and its whole black...

but if i didn't , i still get nothing ..

i suppose its related with normal of the quad . but i didn't define a

normal in the CUSTOMVERTEX, so how could pipeline confirm which side is

face or back?

and why its a black triangle? something goes wrong when it do the color calculation?

kind regards and since i am Chinese , hope you can understand my poor English..

Share this post


Link to post
Share on other sites
A simple demo shows a quard and DolphinVS of SDK.

what i want to do is combine them together .

that means : draw a quard to the center of the "underSea" scene .

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!