About Direct3D - Line Strips
Hi everyone!
I am a university student who just start to learn DirectX.
(I use Borland C++ Builder as my tool.)
I used the example of Tutorial 2 in MSDN Library.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Direct3D_Tutorials.asp
I modified the source code in order to draw "Line Strips".
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Line_Strips.asp
As you can see in this file(compile Vertices.cpp):
http://140.138.148.144/~s922511/Test_1.zip
I found that even though I changed the z-axis value of point,
the result showed in the window still looked like a 2D picture.
How can I make the result looks more like a 3D picture like this:
http://140.138.148.144/~s922511/3D.bmp
What's the problem I faced?
What can I do to create a floor as the picture I have shown above?
Is there anyone can help me to resolve these problems?
I will be very appreciated about that!
If you can help me by modifying my source file in the hyperlink above,
and showing the result I want, that will be great!!
Just e-mail to me when you finish this work.
Thank you very much!!
My E-mail : deathv129@yahoo.com.tw
Please set e-mail's title to "gameDev.Net feedback" so I can recognize it.
Thank you very much!! m(_ _)m
[Edited by - deathv129 on May 1, 2006 9:56:59 PM]
Hello,
You are using the wrong vertex format. Tutorial #2 shows you how to draw a triangle in screen space ( 2D ).
To go 3D you need to change D3DFVF_XYZRHW to D3DFVF_XYZ.
Your vertex structure needs to change to something like:
Since your'e working in 3D you need to set the correct view, projection and world transforms too.
- Pure
You are using the wrong vertex format. Tutorial #2 shows you how to draw a triangle in screen space ( 2D ).
To go 3D you need to change D3DFVF_XYZRHW to D3DFVF_XYZ.
Your vertex structure needs to change to something like:
struct Vertex{ float x, y, z; // rhw taken out DWORD color;};
Since your'e working in 3D you need to set the correct view, projection and world transforms too.
- Pure
After I change D3DFVF_XYZRHW to D3DFVF_XYZ and vertex structure,
my window doesn't show anything.
Can you tell me how to set the correct view, projection and world transforms?
Thank you very much!!
my window doesn't show anything.
Can you tell me how to set the correct view, projection and world transforms?
Thank you very much!!
You'll need to use transformed vertices as stated above. Check out tutorial 3 from the SDK ("Tutorial 3: Matrices"). This is basically the same as tutorial 2 but with transformed vertices (and with this tutorial it should be no problem to go 3d)
Hello,
Try doing something this, not tested and from the top of my head:
// Setup world transformD3DXMATRIX matWorld;D3DXMatrixIdentity( &matWorld );d3d9_device->SetTransform( D3DTS_WORLD, &matWorld );// Setup projection transformD3DXMATRIX matProjection;D3DXMatrixPerspectiveFovLH( &matProj, 45.0f, float( window_width / window_height ), 1.0f, 1000.0f );d3d9_device->SetTransform( D3DTS_PROJECTION, &matWorld );// Setup view transformD3DXMATRIX matView;D3DXVECTOR3 vEyePt ( 0.0f, 0.0f, 0.0f ); // where you are standingD3DXVECTOR3 vLookatPt( 0.0f, 0.0f, 1.0f ); // where you are lookingD3DXVECTOR3 vUpVec ( 0.0f, 1.0f, 0.0f ); // leave this like thisD3DXMatrixLookAtLH( &matView, &vEyePt, &vLookatPt, &vUpVec );d3d9_device->SetTransform( D3DTS_VIEW, &matView);// Setup triangle to be drawn right in front of usVertex triangle[]{ { 0.0f, 1.0f, 1.0f, 0xffff0000 }, // top { 1.0f, -1.0f, 1.0f, 0xff00ff00}, // right { -1.0f, -1.0f, 1.0f, 0xff00ffff }, // left};// Draw triangle// ....
- Pure
Hi everyone!
Here I meet a problem again!
I modified the Toturial 3 in the SDK.
It can show the result I want now.
Here is my source code:
My source code
There is no virus in this zip file, I have scanned it for many times, so don't worry about this!
But it performs an auto rotation of Y-axis now.
I want to use mouse to control the rotation of X-axis and Y-axis.
Furthermore, I also want to use the mouse's scroll wheel to control the depth of z-axis.
Is there anyone can help me to solve these problems?
If you can help me by modifying my source code from the hyperlink above, that will be great!!
Thank you very much!!
Just e-mail to me, when you finish this work.
My E-mail:
deathv129@yahoo.com.tw
(
By the way, some files need a Unicode build when I compile them.
For example, the "EnhancedMesh" sample in the SDK.
What can I do to make my Borland C++ builder 6.0 can compile it?
)
Here I meet a problem again!
I modified the Toturial 3 in the SDK.
It can show the result I want now.
Here is my source code:
My source code
There is no virus in this zip file, I have scanned it for many times, so don't worry about this!
But it performs an auto rotation of Y-axis now.
I want to use mouse to control the rotation of X-axis and Y-axis.
Furthermore, I also want to use the mouse's scroll wheel to control the depth of z-axis.
Is there anyone can help me to solve these problems?
If you can help me by modifying my source code from the hyperlink above, that will be great!!
Thank you very much!!
Just e-mail to me, when you finish this work.
My E-mail:
deathv129@yahoo.com.tw
(
By the way, some files need a Unicode build when I compile them.
For example, the "EnhancedMesh" sample in the SDK.
What can I do to make my Borland C++ builder 6.0 can compile it?
)
Sorry, but its quite unlikely that:
1. Someone will just write the code you want and
2. Email you when they have done it.
If you have money to offer then there are plenty of folk who will be more than happy to be paid to code for you.
If you want mouse control in the way you describe you should take a look at any of the SDK samples and the dxut code since it implements all of these things. Or you can read the mouse messages yourself and use it to modify the view transformation.
1. Someone will just write the code you want and
2. Email you when they have done it.
If you have money to offer then there are plenty of folk who will be more than happy to be paid to code for you.
If you want mouse control in the way you describe you should take a look at any of the SDK samples and the dxut code since it implements all of these things. Or you can read the mouse messages yourself and use it to modify the view transformation.
I have taken a look at the SDK samples "EnhancedMesh".
But my BCB can't compile it.
It just tell me DXUT need a Unicode build and how to make Visual C++ Builder can compile it.
I don't know what to do with BCB.
Anyone can help me?
But my BCB can't compile it.
It just tell me DXUT need a Unicode build and how to make Visual C++ Builder can compile it.
I don't know what to do with BCB.
Anyone can help me?
I'm not sure about how to make the borland compiler work but they should all work with C++ Express and thats free. http://msdn.microsoft.com/vstudio/express/visualc/
Furthermore,
I need to show all the coordinates of every vertexes.
Like this:
http://140.138.148.144/~s922511/3D.bmp
What can I do?
Help me plz!
Thank you very much!
I need to show all the coordinates of every vertexes.
Like this:
http://140.138.148.144/~s922511/3D.bmp
What can I do?
Help me plz!
Thank you very much!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement