PDA

View Full Version : Read texture pixels



Jonte
04-18-2001, 06:43 AM
Is it possible to read individual texture pixels from OpenGL?

I uploaded the textures to GL with glTexImage2D() and for memory reasons I would like to read back one pixel without reading the whole texture back.

/Jonas

DaViper
04-18-2001, 07:45 AM
If you know the Window coordinates of that pixel you can use glReadPixel....

rts
04-18-2001, 07:56 AM
If it's possible, could you read the pixel while you have it in some more convenient format (say, just read in the BMP, or whatever), and store it away?

The only way I can think of is to somehow get it on the screen at a known spot and call glReadPixel (as mentioned above)... but I'm sure some of the smarter people on this board will know of a better/more direct way (or can definitively say it's not possible)

Jonte
04-18-2001, 10:02 PM
Originally posted by DaViper:
If you know the Window coordinates of that pixel you can use glReadPixel....

It might not even be visible so that's a dead end, I'm afraid.

zed
04-19-2001, 12:22 PM
glGetTexImage(..) but it does get the whole of the image.
or do what the others have said (glredapixels), and make sure the texture is visable http://www.opengl.org/discussion_boards/ubb/smile.gif , u could use a pbuffer