Solved

XNA 4.0 HLSL Drawing a Triangle

Posted on 2011-09-10
2
597 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
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!
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

724 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