Hello. I'm wonder - is there're any method for writing some data to specific uv coords in texture? Maybe not to texture, but some shared memory? Actually I need this only in GPU without CPU access.
Write to texture to specific position
Depending on how you are using them there is diffrent methods.
If you want to do stuff in your vertex shader, you could just add a float4 to the inputlay out that you store the data in. this will be stored per vertex, so each vertex will have a set of special data for them there. and from there you can pass it to the pixelshader how ever you want.
You could create a set of extra UV coridnates that correspond to the data you are searching for in the pixelshader.
Thees are two way to do it, i think there is lots more ways to do it, but then you have to do some more research.
No no, that's not what I want. I want to render to, say, upper left pixel in texture, i.e. in uv = (0; 0).
Set it up to be a render target, render a quad there?
Maybe you could use a screen aligned quad rendered in an FBO then use glFragCoord to get the fragment position. *UPDATE* oops! I forgot to ask what API is being used.![]()
Sorry, guys, I didn't understand. Can you explain in more details please? And I'll try to explain what I want - I'm rendering my geometry as usual, but in fragment shader I want to remember some value depending on that fragment position. In order to store something I have to use a texture. But I want to store my data in some ordder - to retrieve it lately. For example, my world is divided by cells and when I shade a pixel I know which cell it belongs to. And I want to store some data, assosiated with that cell. How can I do it?
In d3d11 you could use a structured buffer as UAV and store data in there, based on an index you derive from your UVs?
Tnanks. Sad, by I have very primitive API - something like directX 8.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.