matrix-transform

Mapping a texture from “1D” to “2D” with OpenGL matrix transformations

拥有回忆 提交于 2019-12-02 04:53:56
问题 (With this question I'm trying to investigate an idea I had for solving this other one) If I have a standard 2D array of dimensions width and height in memory, I can turn that into a 1D array of length width * height and then index it via index = x + y * width . This mapping is extremely helpful when allocating and freeing memory for the array as the memory manager does not need to worry about packing the structures in 2D but only needs to worry about the overall length of every allocated

Mapping a texture from “1D” to “2D” with OpenGL matrix transformations

流过昼夜 提交于 2019-12-02 02:01:06
(With this question I'm trying to investigate an idea I had for solving this other one ) If I have a standard 2D array of dimensions width and height in memory, I can turn that into a 1D array of length width * height and then index it via index = x + y * width . This mapping is extremely helpful when allocating and freeing memory for the array as the memory manager does not need to worry about packing the structures in 2D but only needs to worry about the overall length of every allocated array if expressed in 1D. I am trying to see if I can use this same approach for image-memory management