• Advertisement
Sign in to follow this  

Two directX 11 questions.

This topic is 1463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Guys,

 

When creating primitives for instance a quad, is it better to define the vertices a scaled size eg -0.2, 0.2 etc and draw them as is, or is it better to keep them all as 1.0f and apply a scaling transformation later on.

 

Secondly, once we are in world space my object appears with its (model space) center at 0,0 (staying with 2D). Is there a preferred way to organize objects so teh top left pixel of my object start at the top left of the screen (eg, top left pixel is 0,0)?

 

Thank you for your time

Share this post


Link to post
Share on other sites
Advertisement

When creating primitives for instance a quad, is it better to define the vertices a scaled size eg -0.2, 0.2 etc and draw them as is, or is it better to keep them all as 1.0f and apply a scaling transformation later on.

If the quad comes from some resource, load it as it is and modify it in the shader.
If it is something you are creating at run-time, it is your choice. If it is a static 2D object such as those used for post-processing it is best to put them in normalized coordinates and do nothing in the shader, but otherwise it is case-by-case your decision.
 

Secondly, once we are in world space my object appears with its (model space) center at 0,0 (staying with 2D). Is there a preferred way to organize objects so teh top left pixel of my object start at the top left of the screen (eg, top left pixel is 0,0)?

Do what I mentioned for post-processing.
Make the coordinates:

[-1,-1]——[ 1,-1]
   |        |
   |        |
[-1, 1]——[ 1, 1]


And then do not transform them in the vertex shader.


L. Spiro

 

 

PS: Neither question was related to Direct3D 11.

Edited by L. Spiro

Share this post


Link to post
Share on other sites

Thanks for the reply.

 

I don't fully understand what you mean abot rending from top left.

 

So what you are saying is draw it in model space so when it goes into world space it does not need any transforming? How do I know what vertices to choose so it will appear in that location? The area I am confused is how directX uses 'units' as its measurement system. Is there a section where I can change this to 'pixels'? So I can define the vertices as something like

 

5,5;

-5,5;

-5,-5;

5,-5

 

And then say 'draw this 10 by 10 pixel quad at (0,0), the very top left corner.

 

Thanks. It is just a bit confusion cause right now all the guides and tutorials talk about units.

Edited by SteveHatcher

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement