• Create Account

### #Actualriens

Posted 25 April 2012 - 06:53 AM

I have in mind that you render your scene without translating it when handling pinch gesture.

Here is the rendering code:
glMatrixMode(GL_MODELVIEW);

glPushMatrix();

float scale = view->getScale();

CGPoint target = view->getTarget();

glTranslatef(target.x,  target.y, 0);
glScalef(scale, scale * aspectRatio, 0);
glTranslatef(-target.x, -target.y, 0);
renderScene();
glPopMatrix();
renderUI();

As you can see, i translate to the target position, scale and translate back. No explicit translation handled.

Could it be that getScale() returns 1 and you get a division by zero in your touchesMoved routine ?

Whoops, it is possible. Thank you, ill fix it right now.

Did you console log all your scale and translation values to see if they behave in correct way?

Yes, they behave correct. In fact, my puzzle is already released on iPAD, but I cannot pass QA to release it on iPhone because they demand swiping up and down with initial scale

### #2riens

Posted 25 April 2012 - 06:52 AM

I have in mind that you render your scene without translating it when handling pinch gesture.

Here is the rendering code:
glMatrixMode(GL_MODELVIEW);

glPushMatrix();

float scale = view->getScale();

CGPoint target = view->getTarget();

glTranslatef(target.x,  target.y, 0);
glScalef(scale, scale * aspectRatio, 0);
glTranslatef(-target.x, -target.y, 0);
renderScene();
glPopMatrix();
renderUI();

As you can see, i translate to the target position, scale and translate back. No explicit translation handled.

Could it be that getScale() returns 1 and you get a division by zero in your touchesMoved routine ?

No, scale is in range [1.1 ... 3]

Did you console log all your scale and translation values to see if they behave in correct way?

Yes, they behave correct. In fact, my puzzle is already released on iPAD, but I cannot pass QA to release it on iPhone because they demand swiping up and down with initial scale

### #1riens

Posted 25 April 2012 - 06:51 AM

I have in mind that you render your scene without translating it when handling pinch gesture.

Here is the rendering code:
glMatrixMode(GL_MODELVIEW);

glPushMatrix();

float scale = view->getScale();

CGPoint target = view->getTarget();

glTranslatef(target.x,  target.y, 0);
glScalef(scale, scale * aspectRatio, 0);
glTranslatef(-target.x, -target.y, 0);
renderScene();
glPopMatrix();
renderUI();
`
As you can see, i translate to the target position, scale and translate back. No explicit translation handled.

Could it be that getScale() returns 1 and you get a division by zero in your touchesMoved routine ?

No, scale is in range [1...3]

Did you console log all your scale and translation values to see if they behave in correct way?

Yes, they behave correct. In fact, my puzzle is already released on iPAD, but I cannot pass QA to release it on iPhone because they demand swiping up and down with initial scale

PARTNERS