Re: How to Grayscale Texture
Jonathan Dearborn <[email protected]>
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <CA+DSiHYj8rPq59Dz3m-aP9fAEWsz3i8xFfZgkktgoDkcz9GGfA@mail.gmail.com> |
It's that move from GPU to RAM that is costly, not the function. SDL_gpu has a shader interface that would make this a snap. Jonny D On Tue, Jul 26, 2016 at 10:55 AM, ancientcc <[email protected]> wrote: > I give an example of use: 1)Generate tow texture from tow *.png file, 2)Use > SDL_RenderCopy, generate new texture base on these tow texture. 3)Need > grayscale the new texture. > > I have a question, to above case, even use SDL_TEXTUREACCESS_STREAMING, it > require move pixels data from VRAM to system memory. In order to move, is > there method except SDL_RenderReadPixels? > > -----Original Message----- > Is this something that needs to be done in real time, or can you preprocess > the graphics at load time? > > If it needs to be real time, you should use procedural textures, using an > SDL_Surface or a raw buffer as source data. (See > SDL_TEXTUREACCESS_STREAMING.) > > You should absolutely not use SDL_RenderReadPixels(), ever, for anything > other than screenshots and the like. It's typically faster to do all > rendering in software, just to avoid ever moving data from VRAM to system > memory. :-) > > If you want it all really fast and accelerated, you probably need to use > custom shaders, but AFAIK, that's not directly supported by the SDL 2D API, > so you'd have to move to OpenGL or Direct3D. > > > -- > //David Olofson - Consultant, Developer, Artist, Open Source Advocate > > .--- Games, examples, libraries, scripting, sound, music, graphics ---. > | http://consulting.olofson.net http://olofsonarcade.com | > '---------------------------------------------------------------------' > _______________________________________________ > SDL mailing list > [email protected] > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org > > _______________________________________________ > SDL mailing list > [email protected] > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org > _______________________________________________ SDL mailing list [email protected] http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org