views:

328

answers:

1

Hi All, I have a small issue.

I need to enlarge(Zoom) Textures when I hold&drag at the corners.

I am using glOrtho() to setup ModelView.

gl.glOrthof(0.0f, screen_width, -screen_height, 0, -1.0f, 1.0f); //Map exact pixel to World Co-od

I am able to do hit-test and detect corners of the images(Textures) on the screen.

Now I need to enlarge(zoom) the image(texture). I have offset values, means how far I moved on the screen in X,Y directions.

If I need to use glScalef(), it will accept values in percentage(I think). How can I map the offset values to this percentage value.

or is there any other way to zoom(ie by enlarging the background polygon vertices, so that the mapped texture will automatically get zoomed) ? In this method, I am fixing the polygon sides at time of Surface Creation.

Please help me in this.

Thanks in advance. Your help is really appreciated.

A: 

ok... I am answering my own question..

I did this by changing(increasing / decreasing) the vertices values according to stylus move on the screen.

Now, I am able to zoom the image in specified direction.

But, I am not getting exact behavior, like the center of the image(x,y) is not perfect (I am calculating Image boundaries by using image center values). So, the hit-test is not properly functioning.

I am doubting, it may not be the correct way to zoom an image by changing the vertices values.

Still, need to explore. If anybody got any idea, please feel free to share.

Thanks in advance.

Andhravaala