View Full Version : Pick Pixel
12-17-2003, 06:54 PM
Hi, I am displaying .PNG image on the OpenGL window. The image itself contains some transparent pixels (alpha value is 0). Now I want to pick the RGBA value of the pixel, whcih is at the location (x, y). For this I am using glReadPixels, but every time I get the alpha value 255. How to get the correct alpha value? Is there any glEnable setting to access this?
12-17-2003, 07:14 PM
Are you passing GL_RGBA into the 'format' parameter or glReadPixels? Is your pointer to the pixel data 4 bytes per pixel? Also, make sure when you're loading your image that when you call glTexImage2D you specify GL_RGBA. These may sound kind of stupid, but i forget to do them sometimes. It might be something else though. Maybe you could post your code.
You also need a destination alpha channel, and you usually don't get one unless you explicitly ask for it when setting the pixel format.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.