Hello everyone,
I must do a picking of many objects. In c++, I use the color picking and glColor4ub to apply "false" color to the object but how to do use this method in java (unsigned char doesn't exist....)?
Thanks
"Unsigned char" in C more or less maps to (byte) casts on ints in Java. Eg. (byte) 255
Cas :)
Ok thanks. I had some problem with the negative value but it's ok now.
Thanks again
Good morning!
I have resolved the previous problem with the cast.
Unfortunately, I have a new problem: I put the false color to my object using glColor4ub with (for example) the values (-128,-128,-128,-128) and I get my pixel with glReadPixel(x, viewport.get(3) - y, 1, 1, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, pixel) where x and y are the mouse coordinates, viewport.get(3) the window height and pixel a ByteBuffer. The pixel values are -128, -128, -128, -1... why the alpha channel is not equals to -128?
Another problem when I click in different angle on the same object I have, sometimes, the background picked or another object and not the object I clicked on.
If anyone have some hints...
Thanks