Results 1 to 10 of 10

Thread: Matrix problem

Hybrid View

  1. #1

    Thread Starter
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181

    Matrix problem

    Hey where can I learn more about using matrices?

    thanks
    (btw where is the new Directx4vb??)
    Sanity is a full time job

    Puh das war harter Stoff!

  2. #2
    Zaei
    Guest
    www.directx4vb.com =).

    What do you want to know about matricies?

    Z.

  3. #3

    Thread Starter
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    the page does not work.
    I want to know how exactly I can use matrixes to do several translation kind of things. For 2d right now... turning and stuff
    Sanity is a full time job

    Puh das war harter Stoff!

  4. #4
    Zaei
    Guest
    Visual Basic Graphics programming =). Its got all of this stuff in there. Matrix operations can get a bit hairy. Do you know how to do matrix multiplication?

    Generally, for 2D, you use 3x3 matrices, and for 3D you use 4x4 matrices. Basically, you need to know how to multiply NxN matrices together, and where to stick your transformation data. If you want, I can try to post some of the info later (I dont have it handy, at the moment). In the meantime, you might want to try looking for some code on matrix multiplication in VB.

    Z.

  5. #5

    Thread Starter
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    thanks a lot Zaei
    I will have a look but in the worst case I could do that by hand...
    isn't there a function implemented in D3D anyways? Couldn't I just misuse it for 2d transformations? just leave the z blank?

    thanks
    Sanity is a full time job

    Puh das war harter Stoff!

  6. #6
    Zaei
    Guest
    If you are using DX8, you get the D3DX8 library which has functions for both 2d and 3d. If that is the case, its REALLY easy to use them. For rotations, you simply supply the angle in radians, for translations, you simply supply the x and y coordinates. To combine the two, just multiply together. Remember to multiply rotations before translations though =).

    Oh, and for scaling, you just supply the scaler. Apply those before rotations.

    Z.

  7. #7

    Thread Starter
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    alright
    so if I got a simple mesh (2d kind) in DX8 how do I rotate it (I wrote some function of my own using basic trig since it has only a few vertices but still I want to know, might be faster...)
    Sanity is a full time job

    Puh das war harter Stoff!

  8. #8
    Zaei
    Guest
    Matrix operations are generally always faster.

    I misspoke earlier. There arent D3DX functions for 2d matrices. You can fake it, though, by ignoring the Z coordinate. The function you want is D3DXMatrixRotationY(). It takes a matrix and an angle in radians. Set it as your world matrix and it SHOULD rotate your figure, as long as you are NOT using pre-transformed vertices (those with an RHW component).

    Z.

  9. #9

    Thread Starter
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    hm well I do so what do you propose (the game is not any fixed thing yet, not even a game so if it would be best I could start over... I just do it on the weekends to learn a little d3d)
    Sanity is a full time job

    Puh das war harter Stoff!

  10. #10
    Zaei
    Guest
    You should use standard 3d, but instead of using a Perspective Projection matrix (the D3DXMatrixPerspective*() functions), use one of the Orthographic projections(D3DXMatrixOrth*() functions) to get a flat (no perspctive) projection, so it looks 2D. You can then use the 3D matrix functions to your hearts content.

    Z.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width