• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

108 Neutral

About lumia_icy

  • Rank
  1. how to implement a frist-person camera in OpenGL

    [quote name='Freya' timestamp='1344872510' post='4969096'] Here's a very simple OpenGL example: FIrst initialize the camera: [CODE] CCamera cam; cam.position = Vector3D<float>(camX, camY, camZ); cam.lookAt = Vector3D<float>(0.0,0.0,100.0); [/CODE] Then update scene: [CODE] void paintGL() { glClearColor(0.6, 0.8, 0.9, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glLoadIdentity(); //Find current orientation retning = root->EulerAngle(sensitivity,0,0,root->globalAngle*M_PI/180.0); // Where root is SceneNode //Set camera a little bit back cam.position = root->pos - retning*10.0; //Camera sees at the region before us cam.lookAt = root->pos + retning*10.0; //Update camera height cam.position[2] = cam.position[2] + 100.0; cam.lookAt[2] = cam.lookAt[2] + 50.0; drawScene(); swapBuffers(); } [/CODE] Now, each time you move your mouse, update global angle: [CODE]root->globalAngle += sensitivity;[/CODE] or [CODE]root->globalAngle -= sensitivity;[/CODE] [/quote]my question is ..how to use my mouse or how to calculate the move?[img]http://public.gamedev.net//public/style_emoticons/default/ph34r.png[/img]
  2. I am new here and in OpenGL,I wanna implement a first-person camera in OpenGL, but I dont know how to use mouse movement to change the Camera goal,I found that lots of case move the cursor in the center of the screen every time ,I wanna ask is there any other implementation ?Please show me some examples .Thanks![img]http://public.gamedev.net//public/style_emoticons/default/blink.png[/img]
  • Advertisement