Solved

XNA 4.0 HLSL Drawing a Triangle

Posted on 2011-09-10
2
596 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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