android - Convert screen coordinate to OpenGL vertex float point -
When I touch the user screen, I am using OpenGL 2.0 Ess. In order to create an object, according to many samples, I need to define the top by using the float value of x, y, z in an array. I have stumbled on just one problem that I get these float numbers from the screen coordinates Can not Define I have made a line class based on the triangle object class provided by the Android sample.
For now, in my GLSurfaceView class I use the onTouchEvent method, so in my renderer, I use this formula to coordinate the screen for the float point. So, what is the best way to convert You use Float Line Coins [] = New Float [6]; Line quotes [0] = (float) (M.P.R. * 2.0 / WIDTH - 1.0); Line Coords [1] = (Float) (MPR-2.0 / HEIGHT + 1.0); Line quotes [2] = 0.0 f; Line quotes [3] = (float) (x * 2.0 / WIDTH - 1.0); Line quotes [4] = (float) (y * -2.0 / HEIGHT + 1.0); Line quotes [5] = 0.0 f; Originally the formula has followed the glotho array but the result is not satisfactory because it appears that there is a vertical mirror in the center of the screen which pulls the path to the right, if I touch the left and on the other side .
gluUnProject Can get or reverse the modulation and projection matrix and calculation, moving from screen to space coordinates.
Comments
Post a Comment