? Find color value of 'pixel' in color buffer?
Hi
I'm trying to come up with a fast way of doing pixel perfect collision detection, and I don't know if I've stumbled across one.
More importantly, I don't know if it will work on the iPhone, so I thought I'd run it past you guys, ok?
If you know the colors of two differently colored objects, and you write to the color buffer for the first object - call it 'the BACKGROUND', and then you disable writes to the color buffer, and write the other object - call it 'the AVATAR', then where the color of the BACKGROUND would have changed, if they were blended with say an 'additive blend', then at that point you know you have a collision.
Right?
So can this be done on ES 1.1 = I've been googling all afternoon and can't seem to get an answer.
Thanks
I'm trying to come up with a fast way of doing pixel perfect collision detection, and I don't know if I've stumbled across one.
More importantly, I don't know if it will work on the iPhone, so I thought I'd run it past you guys, ok?
If you know the colors of two differently colored objects, and you write to the color buffer for the first object - call it 'the BACKGROUND', and then you disable writes to the color buffer, and write the other object - call it 'the AVATAR', then where the color of the BACKGROUND would have changed, if they were blended with say an 'additive blend', then at that point you know you have a collision.
Right?
So can this be done on ES 1.1 = I've been googling all afternoon and can't seem to get an answer.
Thanks
Elphaba Wrote:If you know the colors of two differently colored objects, and you write to the color buffer for the first object - call it 'the BACKGROUND', and then you disable writes to the color buffer, and write the other object - call it 'the AVATAR', then where the color of the BACKGROUND would have changed, if they were blended with say an 'additive blend', then at that point you know you have a collision.
glReadPixels() will read back values in the color buffer that you can then test. The problem is glReadPixels() is *extremely* slow on the iPhone. If you want to test individual pixel values in that way you'd probably be better off keeping track of your own pixel array separate from OpenGL.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL Pixel Buffer Object setup issue | dotbianry | 2 | 1,093 |
Jan 6, 2013 11:03 AM Last Post: dotbianry |
|
| Problem with the graphics color on a videogame for iphone | femmedragon | 6 | 1,886 |
Dec 16, 2012 07:37 PM Last Post: SethWillits |
|
| How do I do Color Picking? | dockode | 2 | 4,129 |
Sep 24, 2011 08:02 PM Last Post: dockode |
|
| iPhone OpenGL color bug | agreendev | 8 | 5,987 |
Aug 12, 2010 08:20 PM Last Post: AnotherJake |
|
| [CoreGraphics] Image manipulation - pixel by pixel | g00se | 5 | 7,111 |
Jul 28, 2010 08:27 AM Last Post: ThemsAllTook |
|

