Direct3D Tutorial

Co2

Freshman
Joined
May 29, 2003
Messages
34
Location
Universe 2.4.37
Hello,

Direct3D Tutorial 2 for VB.Net from DirectX9 SDK (%DXSDK%\Samples\VB.Net\DirectX3D\Tutorials\Tutorial2) teachs how to render vertices on screen. This tutorial render a triangle on screen.

I want to render a rectangle instead of the triangle in that tutorial. I tried to add a vertice to the vertexbuffer but it doesn't work. I seem to misunderstand the vertices/vertexbuffer concepts. I know this is somewhat easy, but I haven't been able to do it.

Do you have any clues on this ?

Thanks.
 
Everything in Direct3D consists of Triangles, You probably need to add 3 vertices to the VertexBuffer and Draw it using DrawPrimitive with the TraingleList Flag
 
Rendering a rectangle...

Oddly enough, I went through those within the last day or two myself, but I got mine to do a rectangle (which makes this whole topic seem rather odd).

Easiest way is to just add your fourth point to the VertexBuffer and then when rendering use DrawPrimitive.TriangleFan and I believe the last argument of that render call (can't think of what the function is called that you use to render right now) but the last argument is how many elements to render, so you just need to change it from 1 to 2.

It worked for me, if you still have questions just post again and I'll try and find the exact code that I was using, but hopefully that'll work for you.

-Defiant00
 
Back
Top