Sign in to follow this  
Liron

Vertices problem - real new to this but still strange

Recommended Posts

Hello all, I'm just beginning with DirectX and I have a very strange problem which I can't explain, so I thought you could probably help. I took the Vertices example from the SDK tutorials (October Update but i'm sure it's all the same), added a new set of vertices (3, for a triangle) to the vertices variable, changed the size of the created vertex to hold the new vertices as well and changed the DrawPrimitive's "PrimitiveCount" parameter to 2 (so i'd expect to see 2 triangles as supplied by my 6 vertices array with a triangle list primitive type). I also changed the window size to 640*480 instead of the very small 100*100 it was in the original sample. When I ran the sample I expected to see two triangles but instead I saw only the first one (the original one). After playing for awhile I figured out something strange - my new vertices are defined like this: { 400.0f,200.0f,0.5f,1.0f,0xffff0000,}, { 500.0f,250.0f,0.5f,1.0f,0xffff0000,}, { 600.0f,200.0f,0.5f,1.0f,0xffff0000,}, If I was to change the Y coordinate to 250.0f, 200.0f, 250.0f respectivly I would see the second triangle as expected. What's wrong here? My logic and instincts tells me there must be an error somewhere else but I have no idea where to look. It's not a problem with a video card or drivers as I tested this on another machine with the same results. Please help a newbie Thanks Liron

Share this post


Link to post
Share on other sites
I guess it could be you are drawing the triangle counterclockwise with your first set of vertices and thus they are culled by d3d. When you change the y coordinate to the values of 250.0f,200.0f and 250.0f you are then drawing the triangle clockwise which is correct.

Hope this helps,
Steve


Share this post


Link to post
Share on other sites
Great! Thank you very much, that works now. Nowhere in my sources of reading does it say anything about rendering clockwise... Only after searching really deep I found a mentioning and also in the DirectX SDK docs and not anywhere in the books I'm reading, and they're considered good books (for beginners)

Anyway - thank you very much, now I can continue with more understanding

Bye
Liron

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this