[Gambas-user] gb3: OpenGL Rotate and Translate logic
Kevin Fishburne
kevinfishburne at ...1887...
Sun May 27 08:14:31 CEST 2012
On 05/26/2012 01:17 PM, tommyline at ...2340... wrote:
> Oooooops!
>
> I just realized, you use Gl.Ortho mode. That means Glu.LookAt is not for you, I spent few hours trying to figure out how to make it work in ortho, but I can't. It behaves like mad, no matter what origin you set up. Sorry, that's one of the reasons I use perspective mode. I suppose the rotation in 2D is made by rotating world's vertexes, rather than camera, but I can be wrong.
> Sorry for misunderstending you.
>
> Tomek
>
That's it man, now I'm finding out where you live and leaving a bag of
rotten shrimp in your mailbox. ;)
Alright, I'm done with ortho for now and have switched to perspective.
Amazingly it worked nearly perfectly on the first attempt but one weird
thing is happening:
UpVec1 = Sin(Rad(Camera.Orientation))
UpVec2 = Cos(Rad(Camera.Orientation))
UpVec3 = 0
Gl.MatrixMode(Gl.PROJECTION)
Gl.LoadIdentity()
Glu.Perspective(45, sWidth / sHeight, -1, 1)
Gl.MatrixMode(Gl.MODELVIEW)
Gl.LoadIdentity()
Glu.LookAt(Camera.WorldX, Camera.WorldY, 10, Camera.WorldX,
Camera.WorldY, 0, UpVec1, UpVec2, UpVec3)
It appears as though the scene is being rendered vertically inverted,
like taking a screenshot and flipping it vertically in GIMP. Moving
left/right works but moving up/down is backward. I tried experimenting
with the up vector and eye/center Z parameters for Glu.LookAt with no
success. I'll continue researching and experimenting but throw me a bone
if you've seen this before.
--
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271
More information about the User
mailing list