作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
如果使用 OpenGL ES,我一直在尝试找出与 UNPACK_FLIP_Y_WEBGL 行等效的内容。我一直找不到解决方案。
谁能帮我找到一个等价物?
问候
最佳答案
它在 ES 2.0 中不存在。
解决方案从好到坏排序
在编译时翻转图像。
这就是专业人士所做的。为什么要浪费内存和代码,如果不需要,为什么要让用户等待翻转图像?
上下颠倒加载图像(libpng 有该选项)
加载后翻转。
假设每 channel 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;
}
关于javascript - pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15364517/
如果使用 OpenGL ES,我一直在尝试找出与 UNPACK_FLIP_Y_WEBGL 行等效的内容。我一直找不到解决方案。 谁能帮我找到一个等价物? 问候 最佳答案 它在 ES 2.0 中不存在。
我是一名优秀的程序员,十分优秀!