PDA

View Full Version : increasing performance



07-20-2003, 05:28 PM
two questions:

1) I just downloaded new drivers for my video card and openGL is working much faster now. Sandra (from SiSoft) tells me that my video BIOS is old. Would this increase performance even more?

2). I have successfully been able to creat a camera structure and move around in a scene with textured polygons and lighting enabled. Movement is constricted to the xz plane. The up and down keys move back and forth, the right and left keys strafe, and the mouse looks around the scene. Movement with the arrow keys is smooth. However, when I use the mouse to look around it is jerky. I think this is because I use WM_MOUSEMOVE in win proc to mouselook. The following is the code that sets the camera position:

void setCamera()
{

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(cameraData.orientation[0], 1,0,0);
glRotatef(cameraData.orientation[1], 0,1,0);
glRotatef(cameraData.orientation[2], 0,0,1);
glTranslatef(-cameraData.position[0],-cameraData.position[1],
cameraData.position[2]);
}


This is WM_MOUSEMOVE:
case WM_MOUSEMOVE:

if (LOWORD(lParam) > 400) cameraData.orientation[1] += angularSpeed;
if (LOWORD(lParam) < 400) cameraData.orientation[1] -= angularSpeed;
if (HIWORD(lParam) > 300) cameraData.orientation[0] += angularSpeed;
if (HIWORD(lParam) < 300) cameraData.orientation[0] -= angularSpeed;

SetCursorPos(400,300);

if (cameraData.orientation[0] > 90) cameraData.orientation[0] = 90;
if (cameraData.orientation[0] < -90) cameraData.orientation[0] =-90;

RenderScene();
SwapBuffers(hDC);
ValidateRect(hWnd,NULL);

break;

DJSnow
07-21-2003, 06:22 AM
first question:
i believe that updating your bios wouldn't do anything for your performance; apart from that, how would you do that ??

second question/problem:
build in a "motion buffer", for saving the last coordinates (5 for exampe) of your mouse, then by applying the values to the camera direction, you add all motion buffer values, divide them by the content (~length)of the buffer to get a smooth motion, calculated over the last movings of the mouse. i don't know the correct word, but in germany we call this "sliding averaga-value calculation".