Jump to content
  • Advertisement

Archived

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

Aragon

primitive newbie question

This topic is 5644 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 my old programm was directx7...simply convertet to 8... now i want more and intalled directx9sdk but now starts the trouble with primitivdraw calls when i use the code like that (worked since dx5sdk) the background texture is painted in the mouse coordinates...not like it should (fullscreen with litte movement ) , the mouse looks like it should it ignores the coord. of the background completly... if i disable the mouse drawing with // the background is painted correctly... can anybody simply help me? thx p.s.: how can i show code in the white box i often see here in this forum? LPDIRECT3DVERTEXBUFFER9 g_pVB = NULL; // Buffer to hold vertices struct CUSTOMVERTEX { D3DXVECTOR3 position; D3DXVECTOR3 normal; DWORD color; FLOAT tu , tv; FLOAT tu2, tv2; FLOAT tu3, tv3; }; #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX2) CUSTOMVERTEX* pVertices; ..... void init(void) { if( FAILED( g_pd3dDevice->CreateVertexBuffer( 4000*2*sizeof(CUSTOMVERTEX), 0, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pVB, NULL ) ) ) { return E_FAIL; } } .... void show_menu(void) { ... //Show Background cin=0;pVertices[cin].position = D3DXVECTOR3( -170-60+(40*sin( (timeGetTime()/360.0f)*3.141593/180)), 170, 395 ); pVertices[cin].color = D3DCOLOR_ARGB(250,250,250,250) ;pVertices[cin].tu = 0.0f; pVertices[cin].tv = 0.0f; cin=1;pVertices[cin].position = D3DXVECTOR3( 170+60+(40*sin( (timeGetTime()/360.0f)*3.141593/180)), 170, 395 ); pVertices[cin].color = D3DCOLOR_ARGB(250,250,250,250) ;pVertices[cin].tu = 1.0f; pVertices[cin].tv = 0.0f; cin=2;pVertices[cin].position = D3DXVECTOR3( -170-60+(40*sin( (timeGetTime()/360.0f)*3.141593/180)), -170, 395 ); pVertices[cin].color = D3DCOLOR_ARGB(250,250,250,250) ;pVertices[cin].tu = 0.0f; pVertices[cin].tv = 1.0f; cin=3;pVertices[cin].position = D3DXVECTOR3( 170+60+(40*sin( (timeGetTime()/360.0f)*3.141593/180)), -170, 395 ); pVertices[cin].color = D3DCOLOR_ARGB(250,250,250,250) ;pVertices[cin].tu = 1.0f; pVertices[cin].tv = 1.0f; tg=0; g_pd3dDevice->SetTexture(0, g_ppTex[tg]); //Wasser g_pVB->Unlock(); g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 ); g_pVB->Lock( 0, sizeof(pVertices), (void**)&pVertices, 0 ); //Show Mouse cin=0;pVertices[cin].position = D3DXVECTOR3( +0 +(mouse_x*vg), -22 +(-mouse_y*vg) , 390 ); pVertices[cin].color = D3DCOLOR_ARGB(250,250,250,250) ;pVertices[cin].tu = 0.00f; pVertices[cin].tv = 1.00f; cin=1;pVertices[cin].position = D3DXVECTOR3( +18 +(mouse_x*vg), -22 +(-mouse_y*vg) , 390 ); pVertices[cin].color = D3DCOLOR_ARGB(250,250,250,250) ;pVertices[cin].tu = 1.00f; pVertices[cin].tv = 1.00f; cin=2;pVertices[cin].position = D3DXVECTOR3( -0 +(mouse_x*vg), -0 +(-mouse_y*vg) , 390 ); pVertices[cin].color = D3DCOLOR_ARGB(250,250,250,250) ;pVertices[cin].tu = 0.00f; pVertices[cin].tv = 0.00f; cin=3;pVertices[cin].position = D3DXVECTOR3( +18 +(mouse_x*vg), -0 +(-mouse_y*vg) , 390 ); pVertices[cin].color = D3DCOLOR_ARGB(250,250,250,250) ;pVertices[cin].tu = 1.00f; pVertices[cin].tv = 0.00f; tg=100; g_pd3dDevice->SetTexture(0, g_ppTex[tg]); g_pVB->Unlock(); g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 ); g_pVB->Lock( 0, sizeof(pVertices), (void**)&pVertices, 0 ); ... ... }

Share this post


Link to post
Share on other sites
Advertisement
Im no DirectX expert, but I had a problem with DrawPrimitiveUP functionto draw any primitive like points or lines. I found my problem was the I forgot to set the vertex shader up like so


pd3dDevice->SetVertexShader (CUSTOM_VERTEX);

I can't tell if thats the same problem u are having but It was the reason my program kept crashing.

In order to get ur source code in the white boxes like it is in a Visual C++ editor you need to do a little HTML tagging. Here's how if I remember right: Type

[ source ]

..... then your code follows here

...... to end it u must type:

[ / source]

but the above (the HTML tag, [ source ]) u must type with no spaces, I just put spaces so this board wont treat it as code.

Hope I helped in anyway


DarkStar
UK

[/source]


[edited by - dark star on July 5, 2003 9:21:56 AM]

[edited by - dark star on July 5, 2003 9:22:34 AM]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!