problems with axis direction

this, i think is a begginer level problem and so i posted it in the beginers section, but did not get a good respone. hopefully someone over here will help me out.

i m having problems with the direction of my x-axis, it seems to be increasing from right to left. i m using VB6. i have been programming with opengl for 2 yrs now, but i never came across such a prob. this is the first time im using VB with opengl. i have set the camera postion right. iv tried a lot of thingz but i dont know whatz goin wrong. i havent used the “glscalef”, so that shouldnt be a prob. plz help.

maybe you are using translation/rotation functions in a loop without save/restore of the initial matrix (PushMatrix PopMatrix).

Any danger of seeing some code?

herez some of the code that might help

“setviewport code”


wglMakeCurrent mlngPic1hDC, mlngWindowcontext
Pic1.Scale (-100, 100)-(100, -100)
intWidth = Pic1.ScaleWidth
intHeight = Pic1.ScaleHeight
If intHeight = 0 Then
intHeight = 1
End If
glViewport -100, -100, intWidth, intHeight

“setting the projection”

glMatrixMode GL_PROJECTION
glLoadIdentity
glFrustum -100, 100, -100, 100, 10, 210
glMatrixMode GL_MODELVIEW
glLoadIdentity
gluLookAt dblXCam, dblYCam, dblzcam, 0, 0, 100, 0, 1, 0
glShadeModel smSmooth
glEnable glcDepthTest
glEnable (glcBlend)

“rendering function”

glMatrixMode GL_MODELVIEW
glLoadIdentity
glEnable (GL_DEPTH_TEST)
'set back color of map
glClearColor 0, 0, 0, 1
glClear clrColorBufferBit
glClear clrDepthBufferBit
gluLookAt dblXCam, 0, dblzcam, 0, 0, 100, 0, 1, 0
glEnable (glcLighting)
glEnable glcLight0
glEnable glcColorMaterial
glColorMaterial faceFrontAndBack, cmmAmbientAndDiffuse
glPushMatrix
glLineWidth 2
glColor3f 0, 1, 0
glBegin bmLines
glVertex3f -99, -99, 209
glVertex3f -99, 199, 209
glEnd
glColor3f 1, 1, 1
glBegin bmLines
glVertex3f -99, -99, 209
glVertex3f -99, -99, 11
glVertex3f -99, -99, 209
glVertex3f 99, -99, 209
glEnd

gluLookAt dblXCam, dblYCam, dblzcam, 0, 0, 100, 0, 1, 0

What do you have in dblXCam, dblYCam, dblzcam? Specifically in dblzcam?

i have 0 as my dblzcam,dblXcam dblYcam

Originally posted by Rog:
[b][quote]

gluLookAt dblXCam, dblYCam, dblzcam, 0, 0, 100, 0, 1, 0

What do you have in dblXCam, dblYCam, dblzcam? Specifically in dblzcam?[/b][/QUOTE]

Try,
gluLookAt (dblXCam, dblYCam, dblzcam, 0, 0, -100, 0, 1, 0)

From the spec
“The matrix maps the reference point to the negative z axis”

nope. that doesnt work.

Originally posted by Adrian:
[b]Try,
gluLookAt (dblXCam, dblYCam, dblzcam, 0, 0, -100, 0, 1, 0)

From the spec
“The matrix maps the reference point to the negative z axis”[/b]

k fine it works,thank u, but this is not how i want it. cause its gonna mess up all my calculations, cause whatz happening now is it is still drawing in the opposite direction if i c it from front. its just cause im looking from the opposite direction and that is why its working right. why do u think this is happening? i think im goin wrong somewhere else. thankz 4 ur help though.

Originally posted by Adrian:
[b] ok how about
gluLookAt (dblXCam, dblYCam, dblzcam, 0, 0, 0, 0, 1, 0)

where dblzcam=100

[/b]

i m not using any translation or rotation functions in my project.

Originally posted by Andrea Rossini:
[b]maybe you are using translation/rotation functions in a loop without save/restore of the initial matrix (PushMatrix PopMatrix).

[/b]

Originally posted by mithun_daa:
k fine it works,thank u, but this is not how i want it. cause its gonna mess up all my calculations, cause whatz happening now is it is still drawing in the opposite direction if i c it from front. its just cause im looking from the opposite direction and that is why its working right. why do u think this is happening? i think im goin wrong somewhere else. thankz 4 ur help though.

Ok, now I’m suspicous about:

glViewport -100, -100, intWidth, intHeight

The (-100, -100) is supposed to be the viewport origin in Window coordinates. These don’t make sense being negative (correct me someone?). Perhaps this is resulting in a matrix that’s flipping left/right.

Can you do a glGet to see what the viewport actually is set to?

the (-100, -100) is the lower left corner of the viewport (according to the red book).

Originally posted by Rog:
The (-100, -100) is supposed to be the viewport origin in Window coordinates. These don’t make sense being negative (correct me someone?). Perhaps this is resulting in a matrix that’s flipping left/right.

Can you do a glGet to see what the viewport actually is set to?[/b]

Originally posted by mithun_daa:

the (-100, -100) is the lower left corner of the viewport (according to the red book).

Yep. That’s ok (I think). However, if I do this -

Pic1.Scale (-100, 100)-(100, -100)
intWidth = Pic1.ScaleWidth
intHeight = Pic1.ScaleHeight

I get intHeight = -200, which is definitely not valid for glViewport. Can you confirm what you get?

ge, thanx 4 lettin me know that, somewher down the lane im sure it would have created havoc 4 me. but the original problem still persists.

Originally posted by Rog:
[b] [quote]

Pic1.Scale (-100, 100)-(100, -100)
intWidth = Pic1.ScaleWidth
intHeight = Pic1.ScaleHeight

I get intHeight = -200, which is definitely not valid for glViewport. Can you confirm what you get?

[/b][/QUOTE]

still doesnt work