开发者

How to change view point in openGL, c++

开发者 https://www.devze.com 2023-02-28 19:42 出处:网络
I have a shape and I want to view it from different locations decided in the run time. I thought that if I call gluLookAt(...) with the parameters decided, it could change the view location. But, it s

I have a shape and I want to view it from different locations decided in the run time. I thought that if I call gluLookAt(...) with the parameters decided, it could change the view location. But, it seems it does not. I guess I should do some refreshing stuff after changing, I tried glFlush().

Any help would be appreciated. Thank you very much in advance.

void Keyboard(unsigned char key, int x, int y)
{
  switch (key)
  {
  case 'w':       
 开发者_StackOverflow中文版       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        gluLookAt(3,2, 0,   0, 0, 0,   0, 10, 0); 
        glFlush();
        break;

  case 's':
      cout<<"s"<<endl;
      break;
  }
}


OpenGL is not a scene graph, it's just sophisticated "pencil and paper". If you change your scene setup, you've to redraw the full scene.

0

精彩评论

暂无评论...
验证码 换一张
取 消