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

[rtextures] Add texture scale to DrawTextureNPatch() #4757

Open
2 of 4 tasks
michelelorusso05 opened this issue Feb 10, 2025 · 5 comments
Open
2 of 4 tasks

[rtextures] Add texture scale to DrawTextureNPatch() #4757

michelelorusso05 opened this issue Feb 10, 2025 · 5 comments

Comments

@michelelorusso05
Copy link

michelelorusso05 commented Feb 10, 2025

Please, before submitting a new issue verify and check:

  • I tested it on latest raylib version from master branch
  • I checked there is no similar issue already reported
  • I checked the documentation on the wiki
  • My code has no errors or misuse of raylib

It would be nice, if possible, to have a scale parameter on DrawTextureNPatch, like we have on DrawTextureEx. The scaling would be applied before the N-Patch slicing.

Scale = 1 (default):
Image

Scale = 2:

Image

And so on.

@michelelorusso05
Copy link
Author

I quickly put together a DrawTextureNPatchEx with this functionality implemented, going to send a pull request shortly

@raysan5
Copy link
Owner

raysan5 commented Feb 11, 2025

@michelelorusso05 Afair, the requested functionality requires GL_REPEAT for textures repeat but unfortunately it is not supported on all raylib platform (OpenGL ES 2.0 / WebGL could not support it).

Also note that NPatch drawing is probably moved to a separate example in the future, instead of being in the core raylib library. It seems to belong to a higher-level engine.

@michelelorusso05
Copy link
Author

@michelelorusso05 Afair, the requested functionality requires GL_REPEAT for textures repeat but unfortunately it is not supported on all raylib platform (OpenGL ES 2.0 / WebGL could not support it).

That's a shame, I saw the other issue about nine patch repeat not being possible; however, this would be just a quick addition for patch texture scaling, as showed here:

ezgif-489f2d58f677fd.mp4

@raysan5 raysan5 changed the title [rtextures] Add texture scale to DrawTextureNPatch [rtextures] Add texture scale to DrawTextureNPatch() Feb 11, 2025
@raysan5
Copy link
Owner

raysan5 commented Feb 11, 2025

@michelelorusso05 Still, it can be added to current N-Patch example for reference to other users.

@michelelorusso05
Copy link
Author

The only way to do it with the current library would be to create a new scaled texture everytime the scale needs to be updated (correct me if I'm mistaken); I understand that this would still be a very niche use case though, so that's okay if you think that this is not worth the pull request

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

2 participants