简体   繁体   中英

how to get the absolute translation in a 2D opengl es scene

I have a pannable/zoomable image rendered in a 2d opengl es 1.1. After zooming, how can i get the absolute position from the left side of the image to the left side of my viewable area? Heres an image to clarify what i mean:

在此处输入图片说明

Well I don't know much about IOS, but logically speaking, depending on where the origin is and how your image is being drawn onto the screen, you could just calculate the distance from the x position of the image. For instance, if your origin is on the top left of the screen (0,0), and your image is being drawn from the top left (eg. (-10, 0)), then your distance would simply be the absolute value of the x position of your image (eg. 10 units). However, if your origin was lets say, at the center, then you would have to take the screen size into account and subtract half of the width to achieve the distance. It may sound confusing but it should just be basic math.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM