Sign in to follow this  

screen coordinates with d3d

This topic is 4219 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

How do you define screen coordinated with direct3d. For example if you want the screen to have 0,0,0 at the centre and have point 100,100,0 on the top right hand corner of the screen how do you do it.? Currently it has about point 2,2,0 at the top right if you view a rendered shape 5 units in -ve z axis. Do you simply alter the view matirx as described above?

Share this post


Link to post
Share on other sites
If you want to render 2D shapes then you should be using pre-transformed vertices. There are plenty of threads on it if you search forums. The screen coordinates are in the resolution of the backbuffer when in 2D mode.

Search for "renderering in 2D" in the search -----------^

Hope that helps,

Dave

Share this post


Link to post
Share on other sites
Quote:
Original post by Dave
If you want to render 2D shapes then you should be using pre-transformed vertices. There are plenty of threads on it if you search forums. The screen coordinates are in the resolution of the backbuffer when in 2D mode.

Search for "renderering in 2D" in the search -----------^

Hope that helps,

Dave


no i don't want 2d shapes but 3d, my example was just to make things easier to answer.

Share this post


Link to post
Share on other sites
You cannot define a shape in screen (transformed) coordinates and use the transformation pipeline on it.

What exactly are you trying to acheive?

James

Share this post


Link to post
Share on other sites
Quote:
Original post by Xpyder
You cannot define a shape in screen (transformed) coordinates and use the transformation pipeline on it.

What exactly are you trying to acheive?

James


I don't think you understand my original question properly.

Defing a shape with original XYZ coordinated from range 0-100 , is messy. So I found the clipping plane bounderies and altered them and set the viewpoint back along z-axis.

That way I don't need to work in small coordinate numbers for shapes eg 0-1.0 XYZ not UV
I got this to work like I said, so if there is a better way then let me know.


Share this post


Link to post
Share on other sites
Quote:
Original post by ItsDoh
could have just moved the camera back further if you wanted to use larger positions...


good point, I did that as well. My main concern was working with xyz units of greater magnitude than -1.0 to 1.0

Share this post


Link to post
Share on other sites
That shouldn't be a "concern". Theres nothing special about numbers in those range for vertex coordinates. While 3d apis don't usually specify any particular unit, you should kind of think about it in terms of one.

If your camera is 1 foot from the origin, then making something 10 feet wide will be too big. If you're camera is 10 feet from the origin, a 1 foot object will easily fit in its field of view.

So, if you don't like thinking in small floating point units, move the camera back until the size object you'd like to use fits on the screen.

Share this post


Link to post
Share on other sites
Well if thats the case then use your range of values and convert them to a percentage.

The best way is to define everything relatively (0.0 - 1.0) to the model, and then performing transformations on this.

Share this post


Link to post
Share on other sites

This topic is 4219 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this