Jump to content
  • Advertisement
Sign in to follow this  
Liron

Vertices problem - real new to this but still strange

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

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
Advertisement
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
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!