0
\$\begingroup\$

GLFW is clearly an OpenGL framework, which means we are working with graphics card. How input gets handled then?Seems like it handles all of the controllers on our system, not only graphics card.

\$\endgroup\$
  • 1
    \$\begingroup\$ Could you be more specific? Do you mean "How could I handle inputs with GLFW?" Or "How does GLFW do to handle stuff like keyboards events and transmit that to the user?" \$\endgroup\$ – Alexandre Vaillancourt Feb 27 '17 at 13:13
  • \$\begingroup\$ @AlexandreVaillancourt yes, How does GLFW do to handle stuff like keyboards events and transmit that to the user? \$\endgroup\$ – Caleb Feb 27 '17 at 14:24
2
\$\begingroup\$

First of all, GLFW is not a OpenGL framework but a OpenGL applications framework. It's basically a set of libraries and source files which facilitate you the task of build applications. This layer of abstraction allows you to write multi-platform applications without knowing anything of the Operative System API; you don't need to know how Linux manages keyboard events, just learn how GLFW.

To respond your question, keyboard, mouse, window... events are probably processed by the CPU, on the function call glfwPollEvents(). Callbacks may be added with the glfwSetKeyCallback function, as stated here. GLFW will maintain a list of functions (callbacks) to execute when the OS triggers an event.

To simplify the answer, GLFW will manage the following modules of your application (OS independent):

  • OpenGL: OpenGL API management. Mostly processed by the GPU.
  • Window: System window management (resize, resolution, etc). Processed by the GPU (rendering) and CPU (processing).
  • Events: Events fired by the Operative System (keyboard events, mouse events, window events...). Mostly processed by the CPU.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.