Hey where can I learn more about using matrices?
thanks
(btw where is the new Directx4vb??)
Printable View
Hey where can I learn more about using matrices?
thanks
(btw where is the new Directx4vb??)
www.directx4vb.com =).
What do you want to know about matricies?
Z.
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
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.
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
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.
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...)
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.
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)
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.