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

screen_coords_to_world_pos and SSAA #275

Open
gdaviet opened this issue May 21, 2024 · 0 comments
Open

screen_coords_to_world_pos and SSAA #275

gdaviet opened this issue May 21, 2024 · 0 comments

Comments

@gdaviet
Copy link

gdaviet commented May 21, 2024

I am having trouble getting screen_coords_to_world_pos to work with SSAA on:

import numpy as np
import polyscope as ps
import polyscope.imgui as psim


pos = np.array([[-1, 0, 0], [1, 0, 0], [0, 1, 0]])
vtx = [[0, 1, 2]]

ps.init()
ps.register_surface_mesh("tri", pos, vtx)
ps.set_ground_plane_mode("none")

def callback():
    io = psim.GetIO()

    screen_coords = io.MousePos
    world_pos = ps.screen_coords_to_world_position(screen_coords)

    if np.all(np.isfinite(world_pos)):
        psim.TextUnformatted("Hover!")

#ps.set_SSAA_factor(4)

ps.set_user_callback(callback)
ps.show()

Without SSAA, the above runs fine, the label correctly appears when the mouse hovers the triangle. This is no longer the case when the line #ps.set_SSAA_factor(4) is uncommented (or enabled in UI).

Is there a transformation that needs to be applied to the screen_coords with SSAA enabled?
Incidentally, picking seems to work fine, as in the native "Selection" box shows the correct info when clicking on the triangle.

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

No branches or pull requests

1 participant