Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

3DXD

Hard to Explain. Want to place 200,200 texture on 200,200 window

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

Hello, I am trying to figure out the following. I have a texture that is 200,200. I have created a viewport that is 200,200. I want that texture to fit perfectly in there without stretching or distortion. Just like you would see the jpeg if you double clicked it or opened it in a graphics program. However I do not know(if you can), how to figure out what the "3d points"(vectors) would be. Currently I just made up a square and then moved the camera around until it got close enough to view the entire texture in the window. But that is really distorting it. I really just want the picture to fit perfectly in the 200,200 dimensions without distortion etc. It will never move, its just a console for viewing text. Thanks so much!

Share this post


Link to post
Share on other sites
Advertisement
Thanks so much, I don't suppose you have any examples. Lemme try google :-)

Thanks again

[edited by - 3dxd on June 1, 2004 3:00:43 PM]

Share this post


Link to post
Share on other sites
Ok so, I am close to what I want but if anyone can lend a little more info I would be greatful.

When you use ortho projections, how do you set the camera and world projections properly so they don''t affect where the object sits(or do affect it properly).

What my problem is now is that it looks like the bottom left side of my texture is starting at say x = 300 and y = 100 and it gets drawn upwards so its shifted x = 300 and y = 100 upwards, where as of course I want it starting at 0,0 of that current viewport.

I have a 600 wide by 200 tall viewport
I have a jpeg that is 600 wide by 200 tall

I create a ortho LH projection with size h=200 w=600 np=1.0 and Far=1000(just for kicks)

I then set the View transform(camera) to Identity
and set the world to to Identity(originally I have it set to translate 0.0,0.0,5.0 as my vector (or with any z that is between 1 and 1000)

I do get it to appear, just (shifted) where as I want it in the current viewport(totally)

Anyone else have this problem or understand possibly how my stuff is getting shifted without me knowing how or why?

Thanks!

Share this post


Link to post
Share on other sites
I don''t know what you''re using for you camera or object, but why don''t you try shifting it down 100 and left 300?

Zorx (a Puzzle Bobble clone)
Discontinuity (an animation system for POV-Ray)

Share this post


Link to post
Share on other sites
Well I am not exactly sure "how" to shift it and wouldn''t think I should have too, if my camera is sitting on 0.0 and looking straight ahead.

I have tried all sorts of different variations but, currently can''t find one darn example of using an ortho to project a texture(aside from words) which leave out explaining the world(for the object) and camera(view).

based on my understanding othro projections are supposed to make it easy to get the object to fit into the entire viewport, but so far, I don''t find it easy at all, because the docs stink :-)

My ortho project is (200,600,1.0,1000)
My world is (identity) as i want it around the origin(or maybe it nees to be offset, but since its offset doesn''t seem to match is screen res offset, I wouldn''t know how to convert it).

My camera(is simply using the LookAt perspective with 0.0,0.0,-5.0 as its position
0.0,0.0,0.0 as its look at
right/Up are the standard

would be nice if it was easy to find a simple example of displaying a text of X/Y size on a viewport that is of the same size. If I ever figure this out, Im gonna post one.

Thanks

Share this post


Link to post
Share on other sites
Not to distract you from this method, but you can always use transformed vertices (with rhw)... that way you just specify the screen coordinates that you want. To avoid any "blurring" however you need to subtract 0.5 from both the x and y coordinates, but this is well documented in the SDK.

Share this post


Link to post
Share on other sites
Cool, actually that will work too, I just needed to get it there and then draw on top of it with some text. I can do that with this correct?

Thanks a ton :-)

Share this post


Link to post
Share on other sites
I actually got this working now. However I do have one question.

My real image is 600 wide by 200 high

it is not distorted in any way(in mspaint etc).

However loading it into a 600 wide by 200 high, it is distorted.

Specifically all I did was go into Paint and create a rectangle. That rectangle has another inside it that is all black. Leaving a blue equally sized border all away around.

However, when loaded into my display, the sides are really fat and the top is really thin and flat.

Maybe its one of my graphics settings I don't know for sure.
Can anyone help on that.

Thanks!

[edited by - 3dxd on June 1, 2004 8:40:38 PM]

Share this post


Link to post
Share on other sites
If you use DirectX there is a nice thing called ID3DXSprite which dramaticly simplifies what you are trying to achive.

The stretched texture thing: I had the same problem and I just fixed it by makeing a power-of-two texture (for instance a 2^9x2^9 (i.e. 512x512) texture). I didn''t investigate in it futher since it solved my problem, but I''m sure someone else on these boards have a little more insight in it.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!