If you write gl.glTranslatef(0, 0, -10.0f);
your object appears in the center. I can change it to gl.glTranslatef(-2.0f, 0, -10.0f);
and it will move to the left, but is it possible to generate that x value automatically, so it would be on the left for all devices the same? Because I guess if I write gl.glTranslatef(-6.0f, 0, -10.0f);
and it looks good on my screen on the left, it will probably be not good on bigger or smaller devices.
PS Maybe I should get width or something like that?
it depends on the type of view your using, for:
GLU.gluPerspective(gl, 67, glGraphics.getWidth()
/ (float) glGraphics.getHeight(), 0.1f, 10f);
and for
gl.glOrthof(0, WORLD_WIDTH, 0, WORLD_HEIGHT, 1, -1);
i think that they stretch the parameters that you specify in them to every device the same
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.