I’m trying to create a perspective warp using NvAPI_GPU_SetScanoutWarping. Four vertices, one for each corner, are specified in the warping data structure. Each vertex contains a 2D coordinate defined in viewport space, as well as a 4D texture coordinate defined in desktop space. My primitive type is a triangle strip.
For each corner vertex, I calculate the proper w-coordinate for the texture, to facilitate perspective warping. I assume the texture coordinate is internally interpolated using “rgb = textureProj( tex, coordinate.xyzw )”, which is equivalent to “rgb = texture( tex, coordinate.xy / coordinate.w )”.
The warp is correct for displays where desktop coordinates run from (0,0). However, results are wrong for subsequent displays, e.g. with a desktop area of topleft (1920,0), bottomright (3840,1080).
Can you confirm that:
a) texture coordinates for all warps on all displays should be specified in desktop coordinates, where these coordinates are obtained using NvAPI_GPU_GetScanoutConfiguration.
b) texture coordinates, when used in the call NvAPI_GPU_SetScanoutWarping, are internally interpolated using projective texturing
If not, tell me what I should do to fix my perspective warps.