aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-08 20:13:12 -0500
committerDavid Robillard <d@drobilla.net>2023-01-08 22:32:09 -0500
commit5ee8c8f69338870e8062782dfcc08f60d455eb35 (patch)
treec702af776f077aba8b2a24329049adeea3919e73 /test
parent94c96f496c9e22af8fdc59042b59408d04d9c496 (diff)
downloadpugl-5ee8c8f69338870e8062782dfcc08f60d455eb35.tar.gz
pugl-5ee8c8f69338870e8062782dfcc08f60d455eb35.tar.bz2
pugl-5ee8c8f69338870e8062782dfcc08f60d455eb35.zip
Add support for OpenGL ES 3.2 in pugl_shader_demo
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/test_utils.h b/test/test_utils.h
index 8e21d97..e26e970 100644
--- a/test/test_utils.h
+++ b/test/test_utils.h
@@ -22,6 +22,9 @@ typedef struct {
int samples;
int doubleBuffer;
int sync;
+ int glApi;
+ int glMajorVersion;
+ int glMinorVersion;
bool continuous;
bool help;
bool ignoreKeyRepeat;
@@ -314,6 +317,8 @@ static inline void
puglPrintTestUsage(const char* prog, const char* posHelp)
{
printf("Usage: %s [OPTION]... %s\n\n"
+ " -E Use OpenGL ES\n"
+ " -G OpenGL context version\n"
" -a Enable anti-aliasing\n"
" -c Continuously animate and draw\n"
" -d Directly draw to window (no double-buffering)\n"
@@ -335,6 +340,9 @@ puglParseTestOptions(int* pargc, char*** pargv)
0,
PUGL_TRUE,
PUGL_DONT_CARE,
+ PUGL_OPENGL_API,
+ 3,
+ 3,
false,
false,
false,
@@ -346,7 +354,21 @@ puglParseTestOptions(int* pargc, char*** pargv)
char** const argv = *pargv;
int i = 1;
for (; i < *pargc; ++i) {
- if (!strcmp(argv[i], "-a")) {
+ if (!strcmp(argv[i], "-E")) {
+ opts.glApi = PUGL_OPENGL_ES_API;
+ } else if (!strcmp(argv[i], "-G")) {
+ if (++i == *pargc) {
+ fprintf(stderr, "error: Missing OpenGL version argument\n");
+ return opts;
+ }
+
+ const int matches =
+ sscanf(argv[i], "%u.%u", &opts.glMajorVersion, &opts.glMinorVersion);
+ if (matches != 2) {
+ fprintf(stderr, "error: Invalid OpenGL version argument\n");
+ return opts;
+ }
+ } else if (!strcmp(argv[i], "-a")) {
opts.samples = 4;
} else if (!strcmp(argv[i], "-c")) {
opts.continuous = true;