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

Using texture filtering with ImageWidget #755

Open
tomwmth opened this issue Jan 26, 2024 · 3 comments
Open

Using texture filtering with ImageWidget #755

tomwmth opened this issue Jan 26, 2024 · 3 comments
Labels
enhancement New feature or request frozen Blocked by some other case

Comments

@tomwmth
Copy link

tomwmth commented Jan 26, 2024

Related problem

I have an application where I render a simple UI like so:

	SetupStyle()
	scaledWindowWidth := scale(float32(WindowWidth))
	giu.SingleWindow().Layout(
		giu.Align(giu.AlignCenter).To(
			giu.Image(logo).Size(LogoSize, LogoSize),
			giu.ProgressBar(float32(Progress)/13).Size(scaledWindowWidth*0.75, scale(5)),
		),
	)
	PopStyle()

The ImageWidget containing the logo looks extremely bad due to not utilizing mipmaps when it is being scaled down. After investigating the source I saw that these mipmaps are being generated by the library however they aren't being used due to the texture filtering setting. Further investigation revealed that using giu.Context.GetRenderer() I am able to access functions for changing the texture filtering. Despite this, I cannot see how I can use these to affect only my ImageWidget and not the entire application. Letting it apply to the entire application breaks the background and the ProgressBar. By the time it is being rendered the widget is out of my control to influence as changing the texture filtering while the widget is being built (not rendered) is useless.

Unless I am missing something (entirely possible) I do not see how I could achieve the desired behaviour.

Your request

A way to set the texture filtering that is used for ImageWidgets on an individual basis.

Alternative solution

No response

Additional context

No response

@tomwmth tomwmth added the enhancement New feature or request label Jan 26, 2024
@gucio321
Copy link
Collaborator

There is a TextureFiltering example, but it is disabled at the moment because of cimgui-go migration, however it should work on v0.7.0

@gucio321
Copy link
Collaborator

hmm its a bit deeply hidden in current rendering mechanism...
Idk if we'll be able to fix this soon 😢
Maybe it'd be beter for you to scale down your imige and then create a new texture from it?

@gucio321 gucio321 added the frozen Blocked by some other case label Jan 31, 2024
@gucio321
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frozen Blocked by some other case
Projects
None yet
Development

No branches or pull requests

2 participants