Re: How to Grayscale Texture
"ancientcc" <[email protected]>
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <[email protected]> |
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