libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
8.69k stars 1.63k forks source link

Tiling (repeating) texture #4820

Open baidwwy opened 2 years ago

baidwwy commented 2 years ago

Request add a hint to make the texture tiling

https://gamedev.stackexchange.com/questions/136792/is-there-a-way-to-set-texture-wrap-mode-as-repeat-in-sdl-2

opengl GL_REPEAT https://github.com/libsdl-org/SDL/blob/16aeb8d0f5e550ac124096c7b5e03ce756762e12/src/render/opengl/SDL_render_gl.c#L538

d3d D3DTADDRESS_WRAP https://github.com/libsdl-org/SDL/blob/16aeb8d0f5e550ac124096c7b5e03ce756762e12/src/render/direct3d/SDL_render_d3d.c#L1121

Sorry, I don’t know English, this is from Google Translat 438086-957f9fbea4eb9ee2_结果 e

tejohnso commented 2 years ago

Has this been implemented?

baidwwy commented 2 years ago

Has this been implemented?

Not yet, I think there are too many official issues. Sorry, I don’t know English, this is from Google Translat

baidwwy commented 2 years ago

@icculus Can this be added to SDL3? The software rendering part, which I can't achieve

baidwwy commented 2 years ago

@1bsyl

1bsyl commented 2 years ago

Maybe this could be implemented as new function on top of SDL_RenderCopy() So that we don't have do each backend implementation. With batching it's going to be fast ..

slime73 commented 2 years ago

Wrap modes are often part of a Texture's state (or sampler state in newer low level graphics APIs) rather than draw parameters. Once the new low level 3d graphics API exists, it will no doubt be able to manage sampler state so it'd probably be trivial to expose to SDL_Render at that point.

However, as long as SDL_Render supports emulation of non-power-of-two textures, wrap modes can't be properly implemented for those textures on systems that do that.