gpt4 book ai didi

javascript - pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);

转载 作者:可可西里 更新时间:2023-11-01 06:23:29 25 4
gpt4 key购买 nike

如果使用 OpenGL ES,我一直在尝试找出与 UNPACK_FLIP_Y_WEBGL 行等效的内容。我一直找不到解决方案。

谁能帮我找到一个等价物?

问候

最佳答案

它在 ES 2.0 中不存在。

解决方案从好到坏排序

  1. 在编译时翻转图像。

    这就是专业人士所做的。为什么要浪费内存和代码,如果不需要,为什么要让用户等待翻转图像?

  2. 上下颠倒加载图像(libpng 有该选项)

  3. 加载后翻转。

    假设每 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com