Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55f31ddf authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "option to enable multisampling" into gingerbread

parents 992c471c 82962211
Loading
Loading
Loading
Loading
+71 −61
Original line number Original line Diff line number Diff line
@@ -118,10 +118,12 @@ static void checkEGLErrors()
        fprintf(stderr, "EGL Error: 0x%04x\n", (int)error);
        fprintf(stderr, "EGL Error: 0x%04x\n", (int)error);
}
}


static int initGraphics()
static int initGraphics(unsigned samples)
{
{
    EGLint configAttribs[] = {
    EGLint configAttribs[] = {
            EGL_DEPTH_SIZE, 16,
            EGL_DEPTH_SIZE, 16,
            EGL_SAMPLE_BUFFERS, samples ? 1 : 0,
                    EGL_SAMPLES, samples,
                    EGL_NONE
                    EGL_NONE
    };
    };


@@ -164,6 +166,11 @@ static int initGraphics()
    sEglSurface = surface;
    sEglSurface = surface;
    sEglContext = context;
    sEglContext = context;


    if (samples == 0) {
        // GL_MULTISAMPLE is enabled by default
        glDisable(GL_MULTISAMPLE);
    }

    return EGL_TRUE;
    return EGL_TRUE;
}
}


@@ -179,11 +186,14 @@ static void deinitGraphics()


int main(int argc, char *argv[])
int main(int argc, char *argv[])
{
{
    // not referenced:
    unsigned samples = 0;
    argc = argc;
    printf("usage: %s [samples]\n", argv[0]);
    argv = argv;
    if (argc == 2) {
        samples = atoi( argv[1] );
        printf("Multisample enabled: GL_SAMPLES = %u\n", samples);
    }


    if (!initGraphics())
    if (!initGraphics(samples))
    {
    {
        fprintf(stderr, "Graphics initialization failed.\n");
        fprintf(stderr, "Graphics initialization failed.\n");
        return EXIT_FAILURE;
        return EXIT_FAILURE;