   read 2D texture pixel values
  Hi,would anyone know how I can sample/get the values of a specific pixel in a GL_TEXTURE_2D texture?I found glGetTexImage but that copies the whole texture and I only want one pixel.cheersfred   
Oh, i figured out I can do like thisglBindTexture (GL_TEXTURE_2D, tList[SAMPLE]);glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, 1, 0);glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT, &mouseRGB);But now I still have the problem that the value returned clamps at 1.0.Different thread, I suppose. Do I have to use FBO's to get unclamped values?cheersfred   ;  Why do you want values that are greater than 1.0? If you mean you want values between 0 and 255 then simply multiply the returned value by 255.And are you wanting to read the pixel at a specific point on the screen (in which you can use glReadPixels at the co-ordinates) or a specific point within a texture, in which case surely you could read that pixel from the very information you used to load the texture into memory?   ;I am using floating point textures that are also passed through a CG shader.This CG shader might brighten the pixel value up to >1.0.I want to sample pixels to see how bright they are after shader manipulation.And I want to do this interactively with the mouse.glReadPixels is no good as it only gives you clamped values.cheersfred   ;  O ok, I understand now. Unfortunately that is now the end of my involvement. I have not yet started tampering with anything above 8bits/channel.   ;  You'll want to call these somewhere in your initialization.  I'm looking through a project of mine right now, and I think they're all I needed to unclamp texture readbacks (if it still doesn't work, I'll do some more digging):glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, GL_FALSE);glClampColorARB(GL_CLAMP_READ_COLOR_ARB, GL_FALSE);glClampColorARB(GL_CLAMP_FRAGMENT_COLOR_ARB, GL_FALSE);Edit: Also, I should mention that for interactive texture readbacks, reading back a single pixel vs. the whole screen likely won't make much of a difference (the time is spent in transferring the data back to CPU side, not really in how much, to a point), so you can use glGetTexImage.  It doesn't take position parameters like glReadPixels, but it's what I use to read back FP data, so I know it works (with FBO's, which are easy to get the hang of when following along with phantom's article on them).  If you're doing GPGPU and just run some data through your shaders once and then click about to see what happened, you'll probably want to read the whole chunk at one time, anyway.[Edited by - jouley on April 28, 2009 11:43:43 AM];Hi Jouley,thanks for your reply.That looks like it should be the best solution. Nice and simple.But I'm not sure that glClampColorARB() is available on the mac pro I am using to make my app on.Maybe I need to upgrade the OpenGL libraries on my mac or something.Anyway, great suggestion I shall try and make that work.EDIT: Nope its seems like it's not supported on MacOSX. Damn!Back to FBO's then.cheersfred[Edited by - fredrum on April 28, 2009 12:10:48 PM];  Sounds like you don't know what GL_RGB is in this functionglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, 1, 0);GL_RGB tells the driver find me a format that is suitable. That would be a integer format, 8 bit per channel. That comes to 8+8+8=24 bitSince 24 bit is a weird format, it upgrades to 32 bit (GL_RGBA).If you want true floating point, here you gohttp://www.opengl.org/wiki/Floating_point_and_mipmapping_and_filteringuse GL_RGBA32F_ARBAs for FBOhttp://www.opengl.org/wiki/GL_EXT_framebuffer_object;Yes!That made it work.I get confused by all the similar looking format's, type's and internalformat's.Thanks a lot!cheersfred   ;Quote:Original post by V-manGL_RGB tells the driver find me a format that is suitable. That would be a integer format, 8 bit per channel. That comes to 8+8+8=24 bitSince 24 bit is a weird format, it upgrades to 32 bit (GL_RGBA).It may pad the texture format internally, as that is an implementation detail that does not change the semantics of the texture. But it may not change the format from GL_RGB to GL_RGBA, because that adds an alpha channel the user explicitly did not ask for.