Advertisement Jump to content
Sign in to follow this  

OpenGL MFC MDI Mouse Adjustment

This topic is 4963 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I've got another tricky question for yas: How do I calculate the mouse adjustment for Ortho mode in OpenGL for MDI application? For example, I got a toolbar, menu bar, frame width/height etc, how do I calculate the mouse position in absolute screen coordinates that I can get by using GetCursorPos(LPOINT Point)? In usual Win32 application the adjustment is done via:
POINT Point;
	ScreenToClient(GetActiveWindow(), &Point);

	m_PrevCursorPos.x = m_CursorPos.x;
	m_PrevCursorPos.y = m_CursorPos.y;

	m_CursorPos.x = Point.x; 
	m_CursorPos.y = Point.y;

		int Viewport[4];
		glGetIntegerv(GL_VIEWPORT, Viewport);
		m_CursorPos.y = Viewport[3] - m_CursorPos.y;

But I can't figure out what I have to do to calculate it for the current active view.. Please help me adn I will present you all with the greatest GUI and tools of all times :) Thanks.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!