option to enable multisampling
multisampling can be enabled by specifying the number of samples desired on the command line. Change-Id: I5f93c93ae7ada54bcd646c1065e07890d0cb9808
This commit is contained in:
parent
e7bca18f79
commit
8296221138
@ -88,7 +88,7 @@ const char *egl_strerror(unsigned err)
|
||||
case EGL_BAD_NATIVE_WINDOW: return "BAD NATIVE WINDOW";
|
||||
case EGL_BAD_PARAMETER: return "BAD PARAMETER";
|
||||
case EGL_BAD_SURFACE: return "BAD_SURFACE";
|
||||
// case EGL_CONTEXT_LOST: return "CONTEXT LOST";
|
||||
// case EGL_CONTEXT_LOST: return "CONTEXT LOST";
|
||||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user