Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Two directX 11 questions.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 SteveHatcher   Members   -  Reputation: 790

Like
0Likes
Like

Posted 16 January 2014 - 11:02 PM

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



Sponsor:

#2 L. Spiro   Crossbones+   -  Reputation: 19104

Like
1Likes
Like

Posted 16 January 2014 - 11:28 PM

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, 16 January 2014 - 11:51 PM.


#3 SteveHatcher   Members   -  Reputation: 790

Like
0Likes
Like

Posted 17 January 2014 - 01:21 AM

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, 17 January 2014 - 01:21 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS