I need to get the pixel value of the object's texture under the mouse. I figured I can go from mouse position to the position in object's frame by using (in pseudo-code)
posInWorld <- orxRender_GetWorldPosition
posInObject <- orxFrame_TransformPosition
posInTexture <- posInObject - orxObject_GetPivot
Now I need the pixel value at posInTexture
. The best I could find was orxDisplay_GetBitmapData
, but it gets the entire bitmap data, not the data at one point.
I guess the reason why there's no function to fetch the pixel value at a single point is that the data is on the GPU memory and not the main memory. So, I guess I need to read the entire texture and keep it somewhere, is that correct?
OK, I lied at the beginning, I actually need to get the pixel value at some image other than the object's graphic texture. That texture is something like a map of object parts at various points. That texture will never be displayed, so I need to load it separately. What's the cleanest way to do this (especially considering that textures are loaded asynchronously)? Should I orxDisplay_LoadBitmap it, get the bitmap data and then orxDisplay_DeleteBitmap it? Is there a way to read the bitmap directly into a buffer without going through the GPU memory?