screen coordinates with d3d

Started by
7 comments, last by Xpyder 17 years, 11 months ago
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?
Advertisement
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
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.
You cannot define a shape in screen (transformed) coordinates and use the transformation pipeline on it.

What exactly are you trying to acheive?

James
JUST-CODE-IT.NETManaged DirectX & C# TutorialsForumsArticlesLinksSamples
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.


could have just moved the camera back further if you wanted to use larger positions...
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

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.
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.
JUST-CODE-IT.NETManaged DirectX & C# TutorialsForumsArticlesLinksSamples

This topic is closed to new replies.

Advertisement