Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted
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
.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted

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

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...