DirectX (Camera Distance)

This is a discussion on DirectX (Camera Distance) within the C++ Programming forums, part of the General Programming Boards category; Hullo all I'm hoping somebody out there can help me out with this. I'm messing around with DirectX and I've ...

  1. #1
    Epo
    Epo is offline
    Registered User
    Join Date
    Jun 2003
    Posts
    361

    DirectX (Vertex Definitions Change Size on Screen)

    Hullo all

    I'm hoping somebody out there can help me out with this.

    I'm messing around with DirectX and I've managed to Create/Display triangles. Well, one triangle for now. To add coordinates for another Triangle, here's what my code looked like:
    Code:
    MyVertex AllVertices[]=
    {
    	//TRIANGLE 1
    	{-0.5f,  0.5f, 0.0f, 0.0f, 0.0f},
    	{ 0.5f,	 0.0f, 0.0f, 1.0f, 0.5f},
    	{-0.5f, -0.5f, 0.0f, 0.0f, 1.0f},
    	//TRIANGLE 2
    	{-0.5f,  0.5f, 0.0f, 0.0f, 0.0f},
    	{ 0.5f,	 0.0f, 0.0f, 1.0f, 0.5f},
    	{-0.5f, -0.5f, 0.0f, 0.0f, 1.0f},
    };
    And I'm pretty confident that this is the correct way. I'm using one Vertex Buffer for all of my triangles. The code above was close to what I wanted, but, I was hoping to get my second triangle slightly bigger than my first one. So, I changed the code above and made it:
    //TRIANGLE 2
    {-0.7f, 0.7f, 0.0f, 0.0f, 0.0f},
    { 0.7f, 0.0f, 0.0f, 1.0f, 0.5f},
    {-0.7f, -0.7f, 0.0f, 0.0f, 1.0f},
    For the Second Triangle.

    I realize that the two triangles are overlapping, but that's not what's concerning me (I don't think). What happens is, by making the next 3 set of vertices "larger", my scene is rendered differently.

    Keeping everything else the same, and just that small adjustment to sizes, my first triangle, which has been rendering properly until now, is all of a sudden bigger. My render call for the first triangle is:
    D3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 3);
    So, as you can see, I'm not touching the last set of coordinates. Yet, everything seems zoomed in.

    I was hoping somebody out there with experience in DirectX8 has come across this and solved it before Or atleast come across it.

    Thanks for any input

    Edit: Title wasn't the best one
    Last edited by Epo; 12-22-2003 at 02:56 PM.

  2. #2
    Epo
    Epo is offline
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    Bah, I figured it out, it was my render call. The "3" should be a "1". It's number of primitives, and I mistook it for number of vertices.

  3. #3
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Sorry I couldn't help (I've only used direct draw, not D3D), but I thought I might mention DirectX questions are usually posted in the game programming board
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  4. #4
    Epo
    Epo is offline
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    Okie dokes I was torn between the two and picked this one. Thanks for the heads up.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. camera rotation matrix
    By Vick jr in forum Game Programming
    Replies: 5
    Last Post: 05-26-2009, 09:16 AM
  2. LNK2001 ERROR!!! need help
    By lifeafterdeath in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2008, 06:05 PM
  3. directx problem with camera , nothing happens
    By Anddos in forum Game Programming
    Replies: 1
    Last Post: 04-10-2006, 04:14 AM
  4. shortest path problems
    By talz13 in forum C++ Programming
    Replies: 7
    Last Post: 05-08-2004, 07:13 AM
  5. Camera rotation/movement in 3D world
    By tegwin in forum Game Programming
    Replies: 11
    Last Post: 01-24-2003, 01:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21