Sign in to follow this  
Chrislilc

(Fixed, tnx )Gui Projective screenspace. to " rectanglespace" , and back again ?

Recommended Posts

Hi there, I recently have made the change from Unity -> XNA -> SlimDX , now ive got a little problem , im working with DX10-11 and ive set up a load of stuff already, and im loving SlimDx amazing stuff, but i got a simpel problem.

Im currently making a Gui , but my problem is atm i define the location of my gui elements in projective space, -1 to 1 respectivly but what im trying to accomplish is to be able to define my gui elements with coordinates that will range from 0 till whatever my screen resolution is so lets say im at 1024 - 768 ,

512 would be in the middle , now ive created a kind of hacky way of doing this , adding up and deviding , and i calc what 1 pixel is based within a range of

-1 to 1 but this method is not really accurate on different levels.

now my question is how would one accomplish this with pixel accuracy with a resolution independent solution.

Probally a pretty easy solution at hand, just would love some help on this so i can resume my more brainmelting projects where i just am in need of a good gui solution.

Thanks again ,

Chris Fuller

[Edited by - Chrislilc on January 2, 2011 3:19:46 PM]

Share this post


Link to post
Share on other sites
hey there tnx for your reply , srry for my late reply been very busy lately,

ive try'd to play around with a orthogonal projection but i cant seem to figure a right setting , what would i need to render a texture like i mentioned.

im still learning alot but im putting all my time in creating a fbx importer and animation system for my 3d engine. so far fbx importer is almost usable, and animation is in beta stages :) so far so good , and im loving my terrain editor :D but i feel stupid i cant even get a orthogonal prjection up and running.

development will be easyer if i can have a good gui for debug. so i appreciate any help i can get,

tnx alot , chris

Share this post


Link to post
Share on other sites
k so i have got my texture on screen using the next projection matrix

Matrix ortoe = Matrix.OrthoRH(1, 1, -1.0f, 1f);

i was filling in 768 and 1024 in the first two variables 1, 1 this is where i was going wrong i guess 0

atm in my shader this is the only matrix the input.pos is being calculated with , i get a full screen quad rendered on my screen with this setting ,

im gonna try figure out how to translate this using the window with and height etc , still any tips would b cool tnx

, Chris

Share this post


Link to post
Share on other sites
sryy nevermind there was another scaling matrix interfering with my calculations that i dident see at first, stupid me lol i think this is fixed now , just have to work out the details but i think i got it tnx.

, Chris

Share this post


Link to post
Share on other sites

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