Substitution to DirectFB Library

13 Views Asked by At

I am struggling on a Linux application (On a Xilinx Zynq Ultrascale ). I try to use as CPU based app without GPU for drawing. I am trying to draw a rotating rectangle with a texture inside with the DirectFB library.

My Main question is : is it possible to implement an texture 2D rendering application with a 'software' (CPU based) library ?

More of that, Is it possible to do this only using the CPU instead of the GPU.

It seems that DirectFB and DirectFB2 could do that but have no clear documentation and are not maintained anymore ...

I am starting from an OpenGL ES application to do this. My goal would be to change of library for run it on a CPU. To illustrate my goal, here is the graphic update function of my initial code. This turns a geometrical form on the screen (but without texture in it yet).

void GraphicsUpdate(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glUseProgram(programID);
    glVertexAttribPointer(iLocPosition, 3, GL_FLOAT, GL_FALSE, 0, cubeVertices);
    glEnableVertexAttribArray(iLocPosition);

    if(iLocFillColor != -1)
    {
        glVertexAttribPointer(iLocFillColor, 3, GL_FLOAT, GL_FALSE, 0, cubeColors);
        glEnableVertexAttribArray(iLocFillColor);
    }

    static float angleX = 0, angleY = 0, angleZ = 0;
        XMatrixAPI modelView = XMatrixAPI::createRotationX(angleX);
        XMatrixAPI rotation = XMatrixAPI::createRotationY(angleY);
        modelView = rotation * modelView;
        rotation = XMatrixAPI::createRotationZ(angleZ);
        XMatrixAPI translate1 = XMatrixAPI::createTranslation(-1.0,0.0,0.0);
        modelView =  translate1 *rotation * modelView;
        modelView[14] -= 4.5;
        XMatrixAPI perspective = XMatrixAPI::XMatrixAPIPerspective(45.0f, 1280/720, 0.01f, 100.0f);
        XMatrixAPI modelViewPerspective = perspective * modelView;
        glUniformMatrix4fv(iLocMVP, 1, GL_FALSE, modelViewPerspective.getAsArray());
        angleX += 4;
        angleY += 3;
        angleZ += 2;
        if(angleX >= 360) angleX -= 360;
        if(angleX < 0) angleX += 360;
        if(angleY >= 360) angleY -= 360;
        if(angleY < 0) angleY += 360;
        if(angleZ >= 360) angleZ -= 360;
        if(angleZ < 0) angleZ += 360;
        glDrawArrays(GL_TRIANGLES, 0, 36);


    static float angle1X = 0, angle1Y = 0, angle1Z = 0;
        XMatrixAPI modelView1 = XMatrixAPI::createRotationX(angle1X);
        XMatrixAPI rotation1 = XMatrixAPI::createRotationY(angle1Y);
        modelView1 = rotation1 * modelView1;
        rotation1 = XMatrixAPI::createRotationZ(angle1Z);
        XMatrixAPI translate2 = XMatrixAPI::createTranslation(1.0,0.0,0.0);
        modelView1 =  translate2 *rotation1 * modelView1;
        modelView1[14] -= 4.5;
        XMatrixAPI perspective1 = XMatrixAPI::XMatrixAPIPerspective(45.0f, 1280/720, 0.01f, 100.0f);
        XMatrixAPI modelViewPerspective1 = perspective1 * modelView1;
        glUniformMatrix4fv(iLocMVP, 1, GL_FALSE, modelViewPerspective1.getAsArray());
        angle1X += 2;
        angle1Y += 3;
        angle1Z += 4;
        if(angle1X >= 360) angle1X -= 360;
        if(angle1X < 0) angle1X += 360;
        if(angle1Y >= 360) angle1Y -= 360;
        if(angle1Y < 0) angle1Y += 360;
        if(angle1Z >= 360) angle1Z -= 360;
        if(angle1Z < 0) angle1Z += 360;
        glDrawArrays(GL_TRIANGLES, 0, 36);

}
0

There are 0 best solutions below