Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can hide the mouse cursor and make controls handling a little simpler #3

Open
GoogleCodeExporter opened this issue Oct 10, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Just a small suggestion for the tutorial:

If you call the following in your main routine (in the setup before rendering):

-----
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
-----

The mouse cursor will be hidden, which is nicer than to have it sit in the 
middle of the screen. Then you would have to change the 
computeMatricesFromInputs() function in the controls.cpp file:

-----
void computeMatricesFromInputs() {
    // ...

    // Reset mouse position for next frame
    glfwSetCursorPos(window, 0, 0);  // note: 0, 0

    // Compute new orientation (note: -= not +=)
    horizontalAngle -= mouseSpeed * (float)xpos;
    verticalAngle   -= mouseSpeed * (float)ypos;

    // ...
}
-----

Note how the code becomes simpler. Hope this helps, and thanks for the 
tutorials! :)

Original issue reported on code.google.com by andrej.mitrovich on 3 Mar 2014 at 5:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant