I’m on windows and my fragment shader does some raymarching. It writes to the frame buffer just fine, but I have no idea how I can write to another render target and how to read that from the application. I would like to get a buffer that for each pixel contains the world coordinates of the end point of the ray that produced the color of the pixel. I hoped that something along the line of fragData = vec4(rayX, rayY, rayZ, 0.0) would do the job, but I either get index out of bounds or and empty bitmap or no rendered image at all.
and the shader writes to fragData without visible errors, but also without visible results.
I’ve created a texture and assigned it to rendertarget 1, but whenever I do GetData on that texture, it’s all zero. If I make the shader write the additional data to gl_FragColor (that is, fragData, isn’t it?), the data looks good.
I’ve set the texture’s usage to rendertarget, anything else I might be missing?
EDIT: I’ve added the texture to the resource cache, and suddenly it contains data