Reading a pixel from an OpenGL texture (or more than one) with RGBA? (or PNG files)
Hello guys, it's me again XD sorry for being an annoyance :P
I'm trying to do pixel-perfect collision in OpenGL+SDL under Linux. Bounding box collision is working and I have the formulas to get what is the overlapping section in both textures, both relative to the screen and relative to the texture. But now I have to check for every nth pixel in the rectangle to check if the alpha in both textures in that coordinate is 255 (or any other treshold) and return that there was a collision.
My problem is, how can I read the pixels? I've seen that glReadPixels works on the back buffer or something like that, but I'm not gonna work on the back buffer, I'm gonna work on the textures directly (or that's what I'm wanting, anyways) but I haven't found any related info. There's some talk about "PBOs" :confused: and framebuffer, but that isn't what I'm looking for.
If anybody knows how to read X,Y pixel in a RGBA texture generated with "glTexImage2D(GL_TEXTURE_2D, 0, 4, imgFile->w, imgFile->h, 0, GL_BGRA, GL_UNSIGNED_BYTE, imgFile->pixels);", I would be very, very glad! you all guys rock :D
Thanks in advance! :D
- DARKGuy