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

Commit 82962211 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

option to enable multisampling

multisampling can be enabled by specifying the number of
samples desired on the command line.

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

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

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

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

    return EGL_TRUE;
}

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

int main(int argc, char *argv[])
{
    // not referenced:
    argc = argc;
    argv = argv;
    unsigned samples = 0;
    printf("usage: %s [samples]\n", argv[0]);
    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");
        return EXIT_FAILURE;