Thread: Screen Position Calculations - Help Needed

1. Screen Position Calculations - Help Needed

Hello guys,

I've got three values (angles) - x and y that camera is facing (yaw and pitch, and z if needed), these are:

x - heading from true north in OGL coordinates
y - pitch from flat in OGL coordinates

I am wondering if it is possible by using these values to get Screen Position as a vector of xy?

Also, if we have a pitch value from flat Surface, would it be possible to recalculate pitch if camera moves up? If yes, how?

Sorry for asking for help but I am new to OpenGL and desperatly in need of advice.

Best Regards,
Michal

2. so everyone just left this guy for 12 days, I should start a school.
I'm going to teach you everything in one minute !!!!!!!

if you dont want everything, then dont get my example files and dont learn everything,
-== WORLD-3dpnt to SCREEN ==-

void w2s(int xy[2],int fol,double v[3],int x,int y) {
xy[0] = (int)((fol/v[2])*v[0]+x);
xy[1] = (int)((fol/v[2])*v[1]+y);
}

orbital(cameye,3); // .pos has no obliquity. remember
NORMALIZE(cameye); /// required for dotproduct ANGLE(v,v2)
/// crossproduct tho, is always a right angle vector,
/// normal input not needed, normalize crossproduct result.
set16mat(cmatrix,cameye); /// normal input not required
INITVECTOR(camup,cmatrix[4],cmatrix[5],cmatrix[6]);///a normal in the matrix
/// ////////////////// LookAt transform
if(invertmatrix(cmatrix,wmatrix))
/// now begin loop on every point
SUBV(anyPoint,anyPoint,campos);
popmatrix(v,wmatrix,anyPoint);
if Z is positive infront of camera, draw it, clip out xy limits
draw at w2s(f,v) <x y

3. one of these days I might change fol from int to double for more precise adjustments
now needed in OGL @ 200 fps, awesome !!!

first examples in main, is the trig - focal length to field of view.

know the trig laws and right-angle rules

3D 101, heh

4. and here's the working prototype almost as described -

without more testing, I just figure its reversed for leaving ortho2D with 0 at bottom

http://trueinnerbeing.x10host.com/code/scrcap2.png

uses inverted gluLookAt, and gluPerspective with input of fov/2

5. Update, after sizing the window I realize, ooops

gluPerspective(CLAMP(fov/Aspect,0.001,170.0)

I knew 2 was only close but what? it was aspect

6. ok then - beginners will likely begin wrong if they dont have this...

BG stars lights camera scene text = the math that IS the Camera!
http://trueinnerbeing.x10host.com/code/code.html

Worth taking an hour to Google and make high def tga textures and running as eyeCandy.
Improvements very welcome, appreciated and worthwhile - chk it out -

ITS BIGGER
ITS BETTER

how much does anti Aliasing COST? lol

7. Latest Features:
Gravity Simulation: c
Focal len and user defined star size: S,s
Random StarGate. Warps to the stars: 5
StarGate: 6
http://trueinnerbeing.x10host.com/code/code.html
this code answers many questions - got know at least this much about the matrix.
not exactly a newbie - misnomer, hah

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•