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

howto use sdl3 shader api #11160

Open
jcy1001 opened this issue Oct 11, 2024 · 0 comments
Open

howto use sdl3 shader api #11160

jcy1001 opened this issue Oct 11, 2024 · 0 comments

Comments

@jcy1001
Copy link

jcy1001 commented Oct 11, 2024

when i use sdl2 an sdl_gpu lib (SDL_gpu)[https://github.com/grimfang4/sdl-gpu] i can use shader process my image like this
GPU_Image* image = GPU_LoadImage("data/test3.png");
Uint32 color_shader;
GPU_ShaderBlock color_block = load_shader_program(&color_shader, "data/shaders/common.vert", "data/shaders/color.frag");
int color_loc = GPU_GetUniformLocation(color_shader, "myColor");
GPU_ActivateShaderProgram(color_shader, &color_block);
update_color_shader((1+sin(t))/2, (1+sin(t+1))/2, (1+sin(t+2))/2, 1.0f, color_loc);
GPU_Blit(image, NULL, screen, screen->w/4, screen->h/4);

    ,now How do I apply shaders to images in SDL3, and is there any demo code available?
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

1 participant