Skip to main content
gamedev.net
🔒 Locked

Programming RPG book

Started by Zeraan Jan 8, 2003 at 7:32 PM 3 replies 250+ views
Original Post
Zeraan
Zeraan
I've finally got past the initalization of DirectX 8.0, and I'm now on the world, view, and projection transforms. I understand how matrices work, but I'm not quite getting it, in that part about transformations, and I'm not sure if the author was just showing how to rotate and transform, or are planning on using it soon. I just want a simple polygon on screen, but can't get past this part. Is this part necessary for displaying a polygon by itself? Thanks -A real newbie to DirectX3D [edited by - Zeraan on January 8, 2003 9:14:46 PM]
Aprosenf
Aprosenf
There''s essentially two types of vertices - transformed and untransformed. If you''re working with transformed vertices, you set up the x and y values in screen coordinates (e.g. (300, 120)), and you set the reciprocal of the homogenous w-coordinate (rhw) to 1.0. This will skip all of that matrix stuff, but it''s essentially working in 2 dimensions. If you have your vertices in 3D coordinates, you need to set up 3 transformations: the world, view, and projection transformations. The world transformation says how to change model coordinates (e.g. (0, 0, 0) in model space is the center of your object) into world coordinates. If the object is at (10, 0, 10), then the world transformation would change the point (x, y, z) into (x + 10, y, z + 10). The view transformation is essentially the camera transformation - you change the point (x, y, z), which is now in world coordinates, into the point (x'', y'', z'') as it would appear from a camera placed at a certain point in a certain orientation. Finally, the projection transformation turns the point (x, y, z) from 3D space into 2D space. Essentially, it divides the x- and y-coordinates by the z-coordinate, plus some moving it around and scaling it. The end result is a point on the screen, which the renderer draws. If you just want to simply draw a polygon, set the view matrix to the identity matrix, set the world matrix to the position of the object, and use the function D3DXMatrixPerspectiveFoxLH() to generate the projection matrix. There''s a ton of D3DXMatrix* functions to work with matrices. See http://msdn.microsoft.com/library/en-us/dx8_c/directx_cpp/Graphics/Reference/CPP/D3DX/Functions/Math/MathFunctions.asp for the technical data on them. I hope I helped.
Zeraan
Zeraan
Thanks for clarifying that. And also thanks for the link.

I''ll research into it for more details, thanks again.

It''s just that I''ve been used to DirectDraw and simple "Blit that at so and so" instead of rotating, scaling, and transforming it through the world and view then finally rendering it.
spillsome
spillsome
Check Drunken Hyena website

http://www.drunkenhyena.com/docs/d3d_tutorial.phtml#Lesson2a

He does a pretty good job showing how to display a simple polygon on the screen. (on example using screen space and one using model space)

[edited by - spillsome on January 9, 2003 1:33:31 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.