-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Support repeating textures with SDL_RenderGeometry #5369
Conversation
61277ae
to
c3c5462
Compare
I was just working on the same feature for my own use. Here's my implementation of it. I did an OpenGL and DirectX implementation (they seem to work but I'm pretty inexperienced working with these) |
We think this is a good idea for SDL 3.0. |
For what it's worth, maybe a third mode of As a side note, I think storing this per texture seems slightly inflexible for some use cases, although I suppose people can just change it on the texture to be rendered before each draw call if that's supported. However, that might prevent SDL from internally reordering or grouping the draw calls in some way that optimizes performance if that was ever desired. |
Currently wrapping is based on whether texture coordinates are outside of [0,1], but the code is structured so it's easy to add an API to set it and add additional wrapping modes if we want. Fixes libsdl-org#9238 Closes libsdl-org#5369
I went ahead and added the functionality you're asking for here. I didn't expose the wrap mode to the API yet, as I'm not sure that's needed, but if we want it, we can merge #10328. |
This pull request is in a draft state to solicit feedback from the maintainers on the overall design.
Description
This pull request would allow
SDL_RenderGeometry
to draw repeating texture patterns. The default clamped behavior is unchanged, but the user can enable repetition withSDL_SetTextureWrapMode(texture, SDL_WRAPMODE_REPEAT)
.My editor also automatically trimmed some trailing white space in the files I updated.
TODO
SDL_RenderGeometry
for now.Existing Issue(s)
This would partially implement #4820.