glfwGetKey() always return 0, the version is 3.2.1

Created on 9 Mar 2018  路  4Comments  路  Source: glfw/glfw

support

All 4 comments

Can you give us any more information about the problem? e.g. your OS, and what code you are trying to run.

It would also be helpful if you could try running against the latest master (effectively pre-release 3.3) to see if the issue has been fixed already.

OK. The macOS version is 10.12.6, I want to close window when release the escape key. However, the glfwGetKey(window, GL_KEY_ESCAPE) is always return 0 even if I release other keys. The code is
image

glfwGetKey returns current state of the given key, at the moment of the call.

Basically, what you are doing is on any key press/release you are asking GLFW if ESC is not pressed currently.

You should be using the key/scanCode arguments to determine what key got pressed/released.

@ghuser404 oh~ i got it, thanks very much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

voidburn picture voidburn  路  4Comments

Itanq picture Itanq  路  5Comments

leo150 picture leo150  路  4Comments

voxelv picture voxelv  路  4Comments

MarcoLizza picture MarcoLizza  路  4Comments