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

fix HiDPI issue #161

Closed
wants to merge 1 commit into from
Closed

fix HiDPI issue #161

wants to merge 1 commit into from

Conversation

burner-account
Copy link

@burner-account
Copy link
Author

If this one is accepted, you will need to patch the g3nd raycasting demo to obey UI scaling.

func (t *Raycast) onMouse(a *app.App, ev interface{}) {

	// Convert mouse coordinates to normalized device coordinates
	mev := ev.(*window.MouseEvent)
	width, height := a.GetSize()
	scx, scy := a.GetScale()
	x := 2*(mev.Xpos/(float32(width) / scx)) - 1
	y := -2*(mev.Ypos/(float32(height) / scy)) + 1

       // that's it

Comment on lines +187 to 190
// GlfwWindow describes one glfw window

// GlfwWindow describes one glfw window
type GlfwWindow struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the extra lines?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lack of coffee... definitly not intention.

Copy link
Contributor

@wolfgarnet wolfgarnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tentative approval from me.

@danaugrs
Copy link
Member

Thanks @burner-account and @wolfgarnet. There have been a lot of changes since this was created, so I'll close it.
I see you set the following GLFW flag, which we don't set currently:

glfw.WindowHint(glfw.ScaleToMonitor, glfw.True)

Did it have an impact in fixing HDPI?

@danaugrs danaugrs closed this Jun 18, 2022
@burner-account
Copy link
Author

glfw.WindowHint(glfw.ScaleToMonitor, glfw.True)

Did it have an impact in fixing HDPI?

Quite frankly, i do not remember. Might have been only relevant to my system setup without me knowing it.
A quick web search got me the following description:

"ScaleToMonitor - Specifies whether the window content area should be resized based on the monitor current scale of any monitor it is placed on. This includes the initial placement when the window is created."

From my current point of view this should be something configurable in the product using g3n/engine.

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

Successfully merging this pull request may close these issues.

3 participants