View Full Version : texture mapping
09-05-2005, 10:28 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-05-2005, 11:45 PM
i guess what you need is
glReadPixels(x, y, 1, 1, GL_RGB, GL_FLOAT, values);
to read the RGB pixel values from screen position
(x/y) into an array
the ones after x,y are the width/height. you can
read the color values of only one pixel by setting
width/height to 1, but you can read the values of
a rectangle, too.
But bear in mind that this will be mostlikly a lot slower than doing the interpolation on your own.
09-06-2005, 01:35 AM
indeed. but glReadPixels is very easy to implement.
if accuracy is a concern, it may be better to
use a bilinear interpolation algorithm. this
would give better results than opengl, which
normally uses a linear algorithm.
I think you mean bicubic interpolation since OpenGL (and all 3d hardware, except some ancient chips) does support bilinear interpolation, but yes, it will give better results.
09-06-2005, 05:14 PM
sorry do you mean read pixel from frame buffer to main memory? i want to read the hardware inpolation result to the main memory, then do after some work ,put them to the frame buffer.could you please give me some advice?thank you !
09-06-2005, 05:16 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 !
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.