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

Implement min/mag texture filtering #76

Merged
merged 3 commits into from
Oct 6, 2020
Merged

Implement min/mag texture filtering #76

merged 3 commits into from
Oct 6, 2020

Conversation

kettek
Copy link
Contributor

@kettek kettek commented Oct 6, 2020

These changes allow users to call SetTextureMinFilter and SetTextureMagFilter on the MasterWindow to change how textures are
filtered for rendering. This allows pixel-perfect rendering via giu.TextureFilterNearest.

These changes allow users to call SetTextureMinFilter and
SetTextureMagFilter on the MasterWindow to change how textures are
filtered for rendering. This allows pixel-perfect rendering via
giu.TextureFilterNearest.
@AllenDang
Copy link
Owner

@kettek I think those two functions should be added to renderer interface only. Because they are kind of rarely be used, which could remain the simplicity of MainWindow structure.
So the usage could be like this

func main() {
  wnd := g.NewMasterWindow(...)
  g.Context.GetRenderer(). SetTextureMinFilter(...)
  g.Context.GetRenderer(). SetTextureMagFilter(...)
  ...
}

Do you think this is doable?

@kettek
Copy link
Contributor Author

kettek commented Oct 6, 2020

That would certainly be simpler and would be functionally equivalent -- I'll make adjustments.

@kettek
Copy link
Contributor Author

kettek commented Oct 6, 2020

Now adjusted to remove MasterWindow methods.

@AllenDang
Copy link
Owner

@kettek Thanks! Can you add a demo about how to use those two functions?

@AllenDang AllenDang merged commit 658692b into AllenDang:master Oct 6, 2020
@kettek
Copy link
Contributor Author

kettek commented Oct 6, 2020

I've created an example in examples/texturefiltering. One problem I noticed is that sometimes the program will freeze. I think this is due to a race condition stemming from the goroutine for creating the image textures -- giu is accessing the texture variables before they are guaranteed to be populated with the actual texture data. Unfortunately using channels didn't solve the problem (it just froze it entirely... which is strange).

I left commented out in the code additional buttons for setting some other mipmap modes -- I have disabled them since their use causes non-image imgui draw calls to not be rendered.

@kettek
Copy link
Contributor Author

kettek commented Oct 6, 2020

To note, I think this freeze is related to #30

@AllenDang
Copy link
Owner

I tried to solve this once, and I did fix it with giu, but unfortunately the upstream lib GLFW also has same problem. I need to create a PR to GLFW when I got time.

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.

2 participants