Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

MARS_999

My objects are moving wierd with gluLookAt()

This topic is 5775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have some gluSpheres that are rotating and translating around a sun sphere. When I take input from my keyboard to move around using gluLookAt my shperes end up moving off their axis? e.g. if the earth has north and south to indicate up and down when I pass a new value to gluLookAt the earth moves also to keep facing my camera from what I can tell. I don''t want it to move with gluLookAt I want them to stay 90degrees to the plane that they are on? Argh!! Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
You need to give the code which shows how you are drawing the spheres (what sort of rotations/translations in what order) and also the values you are passing to gluLookAt, for us to see whether you are using it correctly.

------------
MSN: nmaster42@hotmail.com, AIM: LockePick42, ICQ: 74128155
"It''s all part of the conspiracy of conspirators conspiring to conspire their own conspiracies..."

Share this post


Link to post
Share on other sites
Code to render the spheres

  
void CPlanet::Render(void)
{
glPushMatrix();
glTranslatef(planet_x, planet_y, planet_z);
glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
glRotatef(75.0f, 0.0f, 1.0f, 0.0f);
glRotatef(static_cast<float>(planet_rotation), 0.0f, 0.0f, 1.0f);
glBindTexture(GL_TEXTURE_2D, texture);
gluSphere(planet, planet_size, 100, 100);
glPopMatrix();
}


main rendering ()

  
void Render(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
// glEnable(GL_BLEND);

// glEnable(GL_ALPHA_TEST);


glLoadIdentity();
gluLookAt(pan_x, pan_y, pan_z, zoom_x, zoom_y, zoom_z, 0.0, 1.0, 0.0);

planet[11].Render();
planet[0].Render();
planet[1].Render();
planet[2].Render();
planet[3].Render();
planet[4].Render();
planet[5].Render();
planet[6].Render();
planet[7].Render();
planet[8].Render();
planet[9].Render();
planet[10].Render();

// glDisable(GL_ALPHA);

// glDisable(GL_BLEND);

glDisable(GL_TEXTURE_2D);

SwapBuffers(g_hdc);
}


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!