I'm trying to learn OpenGL content on Android. In Gl.gltranslatef (x, y, z) call, I am changing my costume + ve x with some units in the direction but I am unable to get the number of pixels which is 1 unit of x?
What I'm doing here: I call gl.glviewport (0,0, width, height); // This will set my rectangle in the lower left corner of 0,0 and then increase it to adjust the width and height.
Then I gl.glfrustrum (-5,5, -7,7,3, 7); // I'm a bit confused about how this call is using the dimensions I set in gl.glviewport.
How to translate from 5 to 5 units in the call from left to right, in pixels of the screen Android?
I mean if width = 320 and height = 533 pixels, then what would be the number of pixels captured on the screen due to gl.glfrustrum call?
I'm designing Xshift as 5.0 and using gl.gltranslatef in call, but it does not translate bitmap into the right or left corner of the screen, when I increase it to 6, Even then one part of it appears on the screen.
Thanksgiving In short, I'm looking for the maximum number of units (in terms of X) which will represent the extreme corners of my Android phone screen.
An important point: Your Gloustrum call not only includes height and width, but also includes a depth. Since you are not specifying the fatem, not the cube, this means that anything happens with Jade coordination anywhere but your frustration will be fairly shortened for the distance of the audience.
In this way, when you for a glTranslatef
, the distance from which a particular object will exit (in the context of pixels) will depend on the distance of the viewer. Apart from this, it is from the viewer, less pixels will be translated into a special side or above / below.
Depending on what you are doing, an easy way to deal with this may be to use Glotho
instead of glFrustum
. glOrtho
returns any theorem scaling, so a given X or Y distance will be translated into the same pixel, regardless of the distance of the viewer
Comments
Post a Comment