View Full Version : texture mapping result
09-05-2005, 10:31 PM
hello,when we do texture mapping ,the graphic hardware do the interpolation of the sample point ,then put samples to the frame buffer.is it right? then i want to get the value after hardware interpolation to the computer main memory.how to do it ? thank you very much!!
09-06-2005, 03:21 PM
Yes, and glReadPixels.
09-06-2005, 05:20 PM
sorry do you mean read pixel from frame buffer to main memory ? i want to read the hardware interpolation results to the main memory in CPU, then do some work ,and then put them to the frame buffer.could you please give me some advice?thank you
09-06-2005, 05:22 PM
You can only get this indirectly. The hardware takes the value it interpolates and uses it as the inmput to the texture environment, so the results you get would depend on the texture environment and then raster operations like blending and ztesting.
You'd have to use a GL_REPLACE texture environment and then read the results from the framebuffer.
If there was blending enabled you'd probably have to glDisable(GL_BLEND) too and of course there's obvious gotchas like alpha test, zbuffer and stencil testing, that would need to be disabled so bear that in mind too.
09-06-2005, 05:28 PM
You do not have this level of access unless you write a shader, you could use the results from a texture sampler in a shader and use subsequent shader instructions to process the texture fetch etc. That would be the smart way to do this if your procesisng could fit in a shader.
This is highly pipelined hardware accelerated graphics, you can't just grab texture values and send them to the CPU whenever it suits you.
The only way to get values out from a texture operation is to draw the results to a buffer of some sort, now you could draw them to an offscreen buffer and then feed that buffer back into another rendering pass as a screenspace texture, but I suspect that's not the answer you were expecting.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.