java – OpenGL: Convert on screen coordinate to OpenGL coordinates-ThrowExceptions

Exception or error:

I draw changing bar in OpenGL ES it has coords (x,y,z).
I would like to add some changes (example: colors in bar) on Action_Down. There is getX(), but this method returns the x coordinate in pixels, but not corresponding coords in OpenGL. Is there some class to convert OpenGL coords to pixels? Or is there any formula for it?

How to solve:

I think you’re looking for this:

It takes coordinates and maps them to window coordinates, with (0, 0) at the top left.

Leave a Reply

Your email address will not be published. Required fields are marked *