English 中文(简体)
如何使中心处于开放式客体听器的位置?
原标题:How do i get the Center position of opengl object iphone?

我的项目。 如果我点击这个开放式物体,我会随意移动。 i 需要获得该物体的中心位置。 这里是我的法典。

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
 if (objShowing == YES) {

     NSLog(@"touch count %d",[touches count]);
     UITouch *touchA,*touchB;
     CGPoint pointA, pointB;

        if ([touches count] == 1)
        {
            touchA = [[touches allObjects] objectAtIndex:0];

            pointA = [touchA locationInView:self];
            pointB = [touchA previousLocationInView:self];

            float yDistance = pointA.y - pointB.y;

            float xDistance = pointA.x - pointB.x;

            GLfloat totalRotation = sqrt(xDistance*xDistance + yDistance*yDistance);

            CATransform3D temporaryMatrix = CATransform3DRotate(currentCalculatedMatrix, totalRotation * M_PI / 180.0, 
                                                                ((xDistance/totalRotation) * currentCalculatedMatrix.m11 + (yDistance/totalRotation) * currentCalculatedMatrix.m12),
                                                                ((xDistance/totalRotation) * currentCalculatedMatrix.m21 + (yDistance/totalRotation) * currentCalculatedMatrix.m22),
                                                                ((xDistance/totalRotation) * currentCalculatedMatrix.m31 + (yDistance/totalRotation) * currentCalculatedMatrix.m32));
            if ((temporaryMatrix.m11 >= -50.0) && (temporaryMatrix.m11 <= 50.0))
                currentCalculatedMatrix = temporaryMatrix;
            else
            {
            }

            [self convert3DTransform:&currentCalculatedMatrix toMatrix:matrix];

            [self adjustView];
        }
}
}



-(void)adjustView{
    NSLog(@"adjusting View");
    [EAGLContext setCurrentContext:context];

    glMatrixMode(GL_MODELVIEW);
    glEnable(GL_NORMALIZE);

    glLoadIdentity();
    glScalef(_scale, _scale, 1.0f);
    glRotatef(-90, 0.0f, 0.0f, 1.0f);
    glRotatef(180, 0, 1, 0);

    glClearColor(0.0f, 0.0f, 0.0f, 0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix();

    //Finally load matrix
    glMultMatrixf(matrix);

    glRotatef(0, 0, 0, 1);
    glRotatef(-90, 1, 0, 0);


        drawTeapot(codesiz);


    glPopMatrix();
    glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
    glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
    [context presentRenderbuffer:GL_RENDERBUFFER_OES];


}
问题回答

开放式自由工没有“能力”。 事情是 drawn弄的。 基本上,开放式的GL只是利用一些称为“框架”的纸张的药房。 这只不过是一纸空文。 由于这一点,你所要求的内容不可能与开放式利比里亚共同体本身。

你们需要做的是,跟踪你在单独结构中提取的所有东西,并且像你再次要求的那样,在这个结构上进行这样的测试和查询。





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签