简体   繁体   English

我怎么能用颜色调色着色器将RGBA转换成BGRA

[英]how can I color-swizzle shader to convert the RGBA to BGRA

I was to do the swizzling as, if I try to convert it later then it seems to be very slow. 如果我稍后尝试将其转换,那么我就是要进行调整,这似乎很慢。 Any examples? 任何例子?

I am using this to make video of my application 我用这个来制作我的应用程序的视频

I currently use 我目前正在使用

 glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data);

and it returns me data in RGBA format, I need to convert it to BGRA how can I do it efficiently? 它以RGBA格式返回数据,我需要将其转换为BGRA如何才能有效地完成?

You know there is a BGRA format, which glReadPixels can deliver: 你知道有一种BGRA格式,glReadPixels可以提供:

glReadPixels(x, y, width, height, GL_BGRA, GL_UNSIGNED_BYTE, data);

And in fact it's recommended you use BGRA for reading pixels, since this is the ordering most GUI systems use internally, thus saving a conversion step. 事实上,建议您使用BGRA读取像素,因为这是大多数GUI系统内部使用的排序,从而节省了转换步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM