Talk About Network

Google





Graphics > OpenGL 3D API > Re: how to chan...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 4769 of 5061
Post > Topic >>

Re: how to change camera location based on object location

by Sourcerer <enlorkMAKNI@[EMAIL PROTECTED] > May 27, 2008 at 03:37 PM

On Mon, 26 May 2008 06:38:39 -0700 (PDT), Shafran wrote:

> Hello
> 
> I am trying to move my gluLookAt to an object position (the object's
> origin) but I can't do it.
> i tried while creating the object to save its matrix:
> glGetFloatv(GL_MODELVIEW_MATRIX,mat); and somewhere else in the code
> to glMultMatrix(mat), but it seems wrong...
> 
> maybe I misunderstand it all?
> 
> can someone help?
> 
> thanks!

If your object is at coordinates a, b, c, and you wish to face towards d,
e, f in the global coordinate system, then call

glLoadIdentity();
gluLookAt(a, b, c, d, e, f, 0, 1, 0);

The last three parameters define the vector that will be pointing up
(towards the top of your screen) when the resulting image is drawn.

-- 
"Let's see what's out there. Engage."
Jean Luc Picard, Star Trek: TNG, Encounter at Farpoint
http://pinpoint.wordpress.com/
 




 3 Posts in Topic:
how to change camera location based on object location
Shafran <odedshafran@[  2008-05-26 06:38:39 
Re: how to change camera location based on object location
Jonathan Campbell <jg.  2008-05-26 15:41:21 
Re: how to change camera location based on object location
Sourcerer <enlorkMAKNI  2008-05-27 15:37:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 16:10:05 PST 2009.