Is it possible to bind a OpenCV GpuMat as an OpenGL texture?

后端 未结 2 1804
慢半拍i
慢半拍i 2021-02-03 12:14

I haven\'t been able to find any reference except for:

http://answers.opencv.org/question/9512/how-to-bind-gpumat-to-texture/

which discusses a CUDA approach.

2条回答
  •  名媛妹妹
    2021-02-03 13:02

    Well here's my understanding, maybe not 100% correct, and apologize for my non-mother-lang-English.

    GpuMat uses Global Memory. However OpenGL textures resides in Texture Memory, which is specially designed for GPU's texture hardware(not CUDA cores). Texture mem are't organized as usual linear 2D/3D arrays, it may use certain Space Filling Curve to organize its content as to optimize texture cache rate. Thus you cannot get a device pointer to Texture. You can only access Texture Mem directly in CUDA via Texture Fetch(Read Only) or Surface R/W.

    Present OpenCV implementation don't seem to use cuda texture/surface feature. You have to copy from textures to Global memory to bind them as GpuMats. Well, not quite a "bind" solution.

    This thread describes a CUDA approach writing to OpenGL textures.

    Either wait for OpenCV to implement the new feature, or wait NVIDIA's new GPU architecture unifying Texture Mem and Global Mem, or wait someone invent a special EMP device to hack these memories ... XD

提交回复
热议问题