Sign in to follow this  
White Scorpion

Multiple little questions

Recommended Posts

White Scorpion    148
1st: Do you guys remember all the function names ? There's so much ! 2nd: How much time does it take to get a good grasp of the basics of DirectX ? ( an average please because I know it changes from one to another ) 3rd: Could someone explain me in detail what this line does ? I didn't understand that FVF part.
const DWORD D3DFVF_VERTEX = D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_DIFFUSE ;
4th: IDirect3DDevice8::SetTransform specifies what kind of transformation to apply right ? ( i.e. the view, the projection and the world ) 5th: What's exactly the world in SetTransform ? 6th: D3DXMatrixIdentity assign the matrix as the world right ? I mean, it tells DirectX that the matrix I passed the function is the world right ? 7th: What exactly is IDirect3DDevice8::SetVertexShader( ) doing ? 8th: What exactly is IDirect3DDevice8::Present( ) doing ? If I understood, it's a little bit like SDL_Flip( ) or some kind of double buffering right ? Well, that's a lot of questions but that's most of it.

Share this post


Link to post
Share on other sites
Supernat02    604
1) You get used to them. The SDK comes in very handy.

2) Depends on how much time you put into it. You will never know enough. There's always more. As a hobby, I'd say give at least 14 hours a week for about 5 months to get up on the basics.

3) The Fixed Function Pipeline uses the FVF(Flexible Vertex Format) to pass in a set of standard parameters to the video card per vertex, while yet still remaining flexible. In the format that you specified, you would be sending the video card XYZ values, UV Texture coordinates, and a diffuse color, per vertex. So each vertex will contain an x, y, z value, a UV texture coordinate (stating where in the texture this vertex would reside), and a color for this vertex. When the card fills the triangle in, it interpolates the texture and color between each vertex.

4) SetTransform specifies which transform to set (view, projection, or world) and the actual transform matrix.

5) The world transform, view transform, and projection transform are concatenated to move vertices from world space to screen space. Vertices are specified in local space. In other words, if a vertex is at (1,1,1) (1 in the x, y, and z direction.) Applying a world transform of (2, 2, 2) will move from local to world space. The vertex will be moved to (2,2,2).

6) D3DXMatrixIdentity is a function to make a D3DXMatrix into an Identity Matrix, with all 1's in the diagonal places. It has nothing to do with the world transform. You might want to set a matrix to the identity matrix, then pass that matrix in as the world transform. This would say "Don't mess with the vertices I'm passing in".

7) I forget, but I think it specifies the FVF in DX8? Otherwise, you can specify a pointer to a vertex shader (or tokenized?) that you've coded using vertex shading language. A vertex shader is a small assembly-like program that is loaded into the video card to adjust the vertices as they are passed into the video card. Using the FVF means that you are using the standard fixed function pipeline...I think on this one, I'm a little rusty.

8) Yes, it's a backbuffer swapping, commit to render.

I highly recommend purchasing a book for beginners, or even most of the more advanced books have very good beginner information in them. Start out with the SDK first. There are some examples in there, and by the time you're about to pull your hair out because they leave little bits and pieces out of them, you start to figure it out on your own. :) Above all, be certain that you really want to invest the time into this...it's not easy, but it sure is fun!

Chris

Share this post


Link to post
Share on other sites
RenderTarget    398
1. Nobody programs much DirectX without the docs open. Don't feel stupid if you need to look things up.
2. As much time as it takes to read through docs and practice stuff. It's all about actually writing code--that's by far the best way to learn it.
3. Read up on flexible vertex formats (FVF) and the fixed-function graphics pipeline. The best thing you can do is read through the docs on this one.
4. SetTransform() sets a matrix to one of several transforms. Again, read up on the graphics pipeline in the docs to see what kinds of transforms there are.
5. D3DTS_WORLD specifies one of the transform types.
6. D3DXMatrixMultiply() just fills a D3DXMATRIX object with identity (zeros with ones down the diagonal). None of the D3DX math stuff sets anything to the device explicitly.
7. SetVertexShader() sets a vertex shader program to the video card. Read up on the programmable pipeline.
8. Present() displays the contents of the back buffer on the screen, typically by doing a buffer switch, though there are several options for it.

In a nutshell, docs, docs, and more docs. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this