Tarus Knicks
Tarus Knicks

Reputation: 3

A way to return control to Windows when window is not the focus OpenGL - C++

I was wondering if there was an OpenGL command to return control to Windows when the window the rendering is happening in is no longer the focus. As it stands, the mouse is constantly moved to the center of the screen even when it is not the focus.

Any way around this?

Thanks!

Upvotes: 0

Views: 320

Answers (2)

Coder
Coder

Reputation: 3715

For windows, make sure you're setting mouse position if windows is active.

if(getactivewindow() == this->hwnd)
    setmousepos()

This is probably the issue.

Upvotes: 0

Nicol Bolas
Nicol Bolas

Reputation: 473577

OpenGL is a rendering API; it does not have commands that deal with the underlying windowing system. WGL, GLX, and Apples AGL do that sort of thing. And even those APIs don't deal with mouse movement.

If the mouse is being forced to the center of the screen by your application, then it is probably due to some other code that you are using. Many of the common tools for creating OpenGL windows (FreeGLUT, GLFW, Qt, wxWidgets, etc) have commands for capturing the mouse and affecting its position. You will need to check your code and the documentation of whatever software you're using to interface with your window to see where the problem lies.

Upvotes: 1

Related Questions