如果使用OpenGL ES,我一直试图找出相应的行,UNPACK_FLIP_Y_WEBGL.我一直无法找到解决方案.
有人可以帮我找一个等价的吗?
问候
解决方法:
它在ES 2.0中不存在.
解决方案从最好到最差
>在编译时翻转图像.
这是专业人士所做的.为什么浪费内存和代码以及为什么让用户等待翻转图像,如果你不需要?
>将图像上下颠倒,(libpng有该选项)
>装载后翻转.
假设每个通道图像有一个RGBA 8比特,那么要翻转的代码是类似的
void flipInPlace(unsigned char* data, int width, int height) {
size_t line_size = width * 4;
unsigned char* line_buffer = new unsigned char[line_size];
int half_height = height / 2
for (int y = 0; y < halfHeight) {
void* top_line = data + y * line_size;
void* bottom_line = data + (height - y - 1) * line_size;
memcpy(line_buffer, top_line, line_size);
memcpy(top_line, bottom_line, line_size);
memcpy(bottom_line, line_buffer, line_size);
}
delete [] line_buffer;
}
原文地址:https://codeday.me/bug/20190723/1510252.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。