Jump to content
  • Advertisement

Archived

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

xstreme2000

Why can't I see anything - D3D

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

This is the first time I''ve initialized Direct3D. I want to see something on my screen so I know whats going on so I wrote this, a two sided triangle...why can I see it?????? void RenderFrame() { D3DVECTOR view_loc; view_loc.y = 0.0f; view_loc.x = 0.0f; view_loc.z = 500.0f; D3DMATRIX view_matrix; D3DUtil_SetViewMatrix(view_matrix, view_loc, D3DVECTOR(0.0f,0.0f,0.0f), D3DVECTOR(0.0f,1.0f,0.0f)); lpDevice->SetTransform(D3DTRANSFORMSTATE_VIEW, &view_matrix); lpDevice->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0); if (SUCCEEDED(lpDevice->BeginScene())) { D3DVECTOR p1 = D3DVECTOR(0.0f,0.0f,0.0f); D3DVECTOR p2 = D3DVECTOR(100.0f,0.0f,0.0f); D3DVECTOR p3 = D3DVECTOR(0.0f,100.0f,0.0f); D3DCOLOR col = D3DRGB(1.0f,0.0f,0.0f); D3DLVERTEX verts[6]; verts[0] = D3DLVERTEX(p1, col, 0, 0.0f, 0.0f); verts[1] = D3DLVERTEX(p2, col, 0, 0.0f, 0.0f); verts[2] = D3DLVERTEX(p3, col, 0, 0.0f, 0.0f); verts[3] = D3DLVERTEX(p1, col, 0, 0.0f, 0.0f); verts[4] = D3DLVERTEX(p3, col, 0, 0.0f, 0.0f); verts[5] = D3DLVERTEX(p2, col, 0, 0.0f, 0.0f); lpDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_LVERTEX, verts, 6, NULL); lpDevice->EndScene(); } lpDDSPrimary->Flip(0, DDFLIP_WAIT); }

Share this post


Link to post
Share on other sites
Advertisement
Probably because you''re not ''looking'' at it.
You also need to set the direction the eye is looking, not just its position. They way your code looks, the triangle is behidn you.

Make you''re position -500.0
Also check the clipping planes, make sure you can see that far away.

Keep pluggin away at it, even copy a demo or two out of the sdk samples. It''s frustrating, but you''ll get the hang of it eventually.

Magmai Kai Holmlor
- The disgruntled & disillusioned

Share this post


Link to post
Share on other sites
I''ve tried setting my position to -500 and I can see for 2000 units so I don''t think thats the problem. I''ve tried loads of thing but none seem to work

Share this post


Link to post
Share on other sites
D3DCOLOR col = D3DRGB(1.0f,0.0f,0.0f);

I haven''t used D3D before, but I''m just wondering if the D3DRGB works from 0.0 to 1.0(with the .x being the colour value) or does it work from 0.0 to 255.0? If the later is the case then that''s a really dark red object.

Again I''ve never used D3D so please correct me if I''m wrong.



-=[ p4n1c ]=-
-=[ Come out swingin'' ]=-

Share this post


Link to post
Share on other sites
Yo dude, look in MSDN. They have a complete example of a full D3D program (i think it spins a teapot ). They walk you through (sort of) step by step the different things you need to do. Follow the tuturial and see if you did everything.

Share this post


Link to post
Share on other sites
Umm... I''m not sure, but I thought that if you use D3DLVERTEX it implies an already lit vertex. Be careful.

Now, perhaps you can''t see it because it''s not lit. Try disabling the lighting. I think it''s like this:


pD3DDevice->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE);


Maybe that will help.... if not, I could perhaps e-mail you some of my (working) D3D code. E-mail me at dusik2000@yahoo.com for that

------------------------
CRAZY_DUSIK* pCrazyDuSiK;
pCrazyDuSiK->EatMicroshaft(MS_MUNCH_BILL_GATES | MS_CHEW_BILL_GATES);

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!