سؤال

أنا أحاول إنشاء مربع غزل داخل Xcode باستخدام OpenGL ولكن بدلاً من ذلك لسبب ما لدي مثلث الغزل؟

أفعل هذا داخل SiO2 ولكني لا أعتقد أن هذه هي المشكلة.

ها هو المثلث:http://img220.imageshack.us/img220/7051/snapzproxscreensnapz001.png

ها هو رمزتي:

void templateRender( void )
{
    const GLfloat squareVertices[] ={
        100.0f, -100.0f,
        100.0f, -100.0f,
        -100.0f, 100.0f,
        100.0f, 100.0f,

    };

    const unsigned char squareColors[] = {
        255, 255, 0, 255,
        0, 255, 255, 255,
        0, 0, 0, 0,
        255, 0, 255, 255,
    };


    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity();

    glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );

    // Your rendering code here...

    sio2WindowEnter2D( sio2->_SIO2window, 0.0f, 1.0f );
    {
        glVertexPointer( 2, GL_FLOAT, 0, squareVertices );
        glEnableClientState(GL_VERTEX_ARRAY);
        //set up the color array
        glColorPointer( 4, GL_UNSIGNED_BYTE, 0, squareColors );
        glEnableClientState( GL_COLOR_ARRAY );

        glTranslatef( sio2->_SIO2window->scl->x * 0.5f,
                     sio2->_SIO2window->scl->y * 0.5f, 0.0f );

        static float rotz = 0.0f;
        glRotatef( rotz, 0.0f, 0.0f, 1.0f );
        rotz += 90.0f * sio2->_SIO2window->d_time;
        glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    }
    sio2WindowLeave2D();    
}
هل كانت مفيدة؟

المحلول

اثنان من نقاطك متماثلين. لذلك لم تقدم سوى ثلاث نقاط فريدة من نوعها وبالتالي لديك مثلث.

النقطة التي تفتقدها هي -100.0F ، -100.0F ،

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top