On 05/27/2012 02:14 AM, Kevin Fishburne wrote: > On 05/26/2012 01:17 PM, tommyl...@eircom.net 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. >
I'll be damned. I think I got it. Looks like applying a certain scale transformation to the projection matrix does it: Gl.MatrixMode(Gl.PROJECTION) Gl.LoadIdentity() Glu.Perspective(45, sWidth / sHeight, -1, 1) Gl.Scalef(1, -1, 1) Thanks for all your help. Hopefully I can move forward with this under my own power and not have to bother the list again for a while. -- Kevin Fishburne Eight Virtues www: http://sales.eightvirtues.com e-mail: sa...@eightvirtues.com phone: (770) 853-6271 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user