Hi !

Anybody can lead me from where can I obtain the rotation and moving of camera poisition with mouse and keys ! (if possible , demo and source code will be wellcome )

Thnx!

Hi !

Anybody can lead me from where can I obtain the rotation and moving of camera poisition with mouse and keys ! (if possible , demo and source code will be wellcome )

Thnx!

void ArcBallRotate(float x,float y)

{

float n[3];

```
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(sqrt((double)(x*x+y*y))/1.5,y,-x,0.0);
n[0]=GlMode->ModelViewMatrix[12];
n[1]=GlMode->ModelViewMatrix[13];
n[2]=GlMode->ModelViewMatrix[14];
GlMode->ModelViewMatrix[12]=0.0;
GlMode->ModelViewMatrix[13]=0.0;
GlMode->ModelViewMatrix[14]=0.0;
glMultMatrixf((GLfloat*)&GlMode->ModelViewMatrix);
glGetFloatv(GL_MODELVIEW_MATRIX,GlMode->ModelViewMatrix);
GlMode->ModelViewMatrix[12]=n[0];
GlMode->ModelViewMatrix[13]=n[1];
GlMode->ModelViewMatrix[14]=n[2];
glLoadMatrixf(GlMode->ModelViewMatrix);
```

}

this might help, it rotates around the origin of the modelmatrix no matter the translation.

GlMode??? What is its type so that I can declare it and get the code building. I’m trying to get full 360 deg. flying in my open gl app.

I was about to ask the same question !

By the way , which way is more reasonable when you compare changing postion of camera with gluLookAt or as you do just scaling the image ?

Thnx for help!

How about asking this question on the beginner’s forum? Or on a forum specific to your input mechanism or OS? Or perhaps just go to http://nehe.gamedev.net/ and download the appropriate tutorials?