Skip to main content
GameDev.net gamedev.net
🔒 Locked

Perspective help

Started by relpats_eht Apr 23, 2004 at 1:34 PM 8 replies 500+ views
Original Post
relpats_eht
relpats_eht
Well, this may sound lame, but i need to know what the code is for bad perspective calculations. like, the object position on the screen doesnt rotate it, or change position on zoom in and out. its for a game im making, and right now im working on the character generator. the screen that shows what it currently looks like is off to the side, so the character doesnt look directly at you, and when i zoom in, it moves up and to the right. thanx
relpats_eht
CodeMunkie
CodeMunkie
Was there a question in there somewhere? Sorry, but I can not understand what you are asking or what you are trying to accomplish.
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
relpats_eht
relpats_eht
im trying to make it so that even if an object is not in the center of the screen, the perspective calculations do not rotate it basicly.
relpats_eht
Halo_FF
Halo_FF
You are still not being clear on exactly what it is you are trying to do. Are you talking about holding a perspective view of what you are looking at while being able to change other views?
CodeMunkie
CodeMunkie
quote:
the perspective calculations do not rotate it basicly.


This is the part that don''t jive. What behavior are you seeing now, and what behavior did you expect? I don''t see what perspective calculation has to do with rotation.
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
nonpop
nonpop
I'm not trying to offend you in any way, but you should really try to express yourself clearer (not that I would be good at it...) I'm doing this only so that you could get better answers.
quote:
the object position on the screen doesnt rotate it, or change position on zoom in and out.

There's some ambiguity here...
1. How will the position of the object rotate anything? Isn't that the rotation's job? And what doesn't it rotate?
2. "the object position (...) doesnt (...) change position on zoom" (* see my note below)
quote:
the screen that shows what it currently looks like is off to the side, so the character doesnt look directly at you, and when i zoom in, it moves up and to the right.

So, is this how it should be or how it should not be?

(*)NOTE: Before you post, re-read it and at the same time think if someone not knowing every detail of the problem will be able to understand it. Also, try to get punctuation and grammar as correct as possible because that is a great way to reduce mis-understandings.

EDIT: Added a missing word


[edited by - nonpop on April 23, 2004 3:46:18 PM]
relpats_eht
relpats_eht
well, what im trying to say is, with the current perspective mode i am using, if i draw a square in the exact center of the screen pointing toward me (in an orientation that it is invisible, or a very thin line) and then move it over, it sort of turns slightly so that then i can see a thicker and thicker line. and i dont want that

like if u hold ur hand sideways in front of ur nose (so it is as thin as possible) and then move it to the right, u can see more and more of ur palm. yeah, i just dont what the perspective calculations to do that.

thats pretty much the best i can explain it...
relpats_eht
nonpop
nonpop
This is what I can get out of your posts:

You want to have two views, one in a corner or something and one, bigger, in the middle of the screen. Like this

+---+---------+
| | |
| | |
|---+ |
| |
| |
+-------------+

The smaller view is sort of a "preview" view which is independent of the actual "editor" view.

You can accomplish this by first rendering the editor view. You then change the viewport to the smaller view and render it with whatever transformations you want. Pseudocode:

RenderEditor ();
PushViewport (); // store current viewport

SetViewport (0,0,preview_width,preview_height); // set preview viewport

RenderPreview ();
PopViewport (); // restore original viewport




[edited by - nonpop on April 23, 2004 5:50:19 PM]
chowe6685
chowe6685
you could try an orthagonal projection matrix, look at
glOrtho
relpats_eht
relpats_eht
thanx, but i already fixed it. i used some math to caculate the ofset the perspective veiw imposed in both rotation onf position, then edited those vars. looks and works fine now.
relpats_eht

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.