Solved

XNA 4.0 HLSL Drawing a Triangle

Posted on 2011-09-10
2
589 Views
Last Modified: 2012-05-12
I came across an article that didn't go into much depth.  Is it possible for an Effect file to automatically draw a triangle, if I feed it a Vector3 location?

0
Comment
Question by:Iamtehbest
  • 2
2 Comments
 
LVL 12

Expert Comment

by:satsumo
ID: 36523507
As far as I'm aware no current rendering architecture can create vertices in a shader.  To draw a triangle you need to give it three vertices.  The closest you coan get is using a point sprite with an image of triangle.

Strangely the PS2 could do this, and I suspect modern hardware works the same way.  It's the programming interfaces that get in the way.
0
 
LVL 12

Accepted Solution

by:
satsumo earned 500 total points
ID: 36526797
Then again, maybe I was wrong.  This article describes a method of drawing multiple instances in Direct 3D, you may be able to use this method.  You still give it three vertices for a triangle, but the instance data could be a single point and the shader could change the output based on that point.

http://msdn.microsoft.com/en-us/library/bb173349(v=vs.85).aspx
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now