🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

no triangle in immediate mode

Started by
3 comments, last by LeeIsMe 24 years, 9 months ago

Well,

See, you are setting the color component to 0.0f, which is pure black. (b = 0). I think thats where you're going wrong...
Everything else seems ok for me...

- prauppl

- prauppl
Advertisement
I'm not sure, but I remember when I was messing around with TL_VERTEX that the Z value was _real_ sensitive. Try putting it to 0.5f.

If that doesn't help, give me an email (snowman_83@yahoo.com) and I'll look up how I did it.

-Snowman

I had a similar problem when converting some of my code from DirectX 5.0 to 6.1. If you are not using 6.1 or are not using the new IDirect3DDevice3 interface, then this probably won't help, but if you are, you simply need to change the following in your call to DrawPrimitive

D3DVT_TLVERTEX
< to >
D3DFVF_TLVERTEX

This is because the new DrawPrimitive makes use of the flexible vertex formats. D3DFVF_TLVERTEX is for compatibility with older versions of DirectX. Hope this helps!

The following code gives no errors, but doesn't show anything on the screen either.

ddevice->BeginScene();

D3DVECTOR p1( 0.0f, 100.0f, 0.0f );
D3DVECTOR p2( 50.0f,150.0f, 0.0f );
D3DVECTOR p3(20.0f,40.0f, 0.0f );

D3DCOLOR b = 0; //black
Vertices[0] = D3DTLVERTEX( p1, 100, b,b,0, 0 );
Vertices[1] = D3DTLVERTEX( p2, 100, b,b,0, 0 );
Vertices[2] = D3DTLVERTEX( p3, 100, b,b,0, 0 );

ddevice->DrawPrimitive(D3DPT_TRIANGLELIST,D3DVT_TLVERTEX,(LPVOID)&Vertices,3,D3DDP_DONOTCLIP);

ddevice->EndScene();

------------------
http://mazurek.dhs.org/3d/

I figured out it was not showing because of back face culling.

This topic is closed to new replies.

Advertisement