#177363 - hacker013 - Fri May 11, 2012 8:54 pm
heyhey ^^,
I wanted to use difference in pixel color for collision, because my game only use some basic colors. So I googled how to get pixel color in opengl, there is the function available called glReadPixel, but unfortunaly it wasn't supported by libnds. So I got an idea, I new NitroEngine supported screenshots. So I found the code which NitroEngine used to retreive the colors from vram. I created the following code from that code:
But this function always returns always 0, I use the basic dual screen setup from NitroEngine. Could somebody point me out what I'm doing wrong?
~Hacker013
_________________
Website / Blog
Let the nds be with you.
I wanted to use difference in pixel color for collision, because my game only use some basic colors. So I googled how to get pixel color in opengl, there is the function available called glReadPixel, but unfortunaly it wasn't supported by libnds. So I got an idea, I new NitroEngine supported screenshots. So I found the code which NitroEngine used to retreive the colors from vram. I created the following code from that code:
Code: |
u16 drawGetColor(int x, int y)
{ u16 color = 0; if(NE_Dual) { if(y>191) { color=VRAM_C[256*192-(y-192+1)*256+x]; } else { color=VRAM_D[256*192-(y+1)*256+x]; } } else { color=VRAM_D[256*192-(y+1)*256+x]; } return color; } |
But this function always returns always 0, I use the basic dual screen setup from NitroEngine. Could somebody point me out what I'm doing wrong?
~Hacker013
_________________
Website / Blog
Let the nds be with you.