summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--glslview.c16
-rw-r--r--glslwrite.c16
2 files changed, 26 insertions, 6 deletions
diff --git a/glslview.c b/glslview.c
index b0b5d1b..2444725 100644
--- a/glslview.c
+++ b/glslview.c
@@ -172,17 +172,27 @@ static void handle_input(const char *input) {
}
static void usage(void) {
- fprintf(stderr, "Usage: glslview [-t <time>] [-s <speed>] [-0 <param0>] [-1 <param1>] [-2 <param2>] <shader>\n");
+ fprintf(stderr, "Usage: glslview [-w <width>] [-h <height>] [-t <time>] [-s <speed>] [-0 <param0>] [-1 <param1>] [-2 <param2>] <shader>\n");
exit(1);
}
int main(int argc, char *argv[]) {
+ int width = 800, height = 800;
+
while (true) {
- int c = getopt(argc, argv, "t:s:0:1:2:");
+ int c = getopt(argc, argv, "w:h:t:s:0:1:2:");
if (c == -1)
break;
switch (c) {
+ case 'w':
+ width = atoi(optarg);
+ break;
+
+ case 'h':
+ height = atoi(optarg);
+ break;
+
case 't':
current_time = init_time = atof(optarg);
break;
@@ -220,7 +230,7 @@ int main(int argc, char *argv[]) {
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
- SDL_Window *window = SDL_CreateWindow("glslview", 0, 0, 800, 800, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
+ SDL_Window *window = SDL_CreateWindow("glslview", 0, 0, width, height, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
SDL_GLContext ctx = SDL_GL_CreateContext(window);
filename = argv[optind];
diff --git a/glslwrite.c b/glslwrite.c
index 6673146..5b09c86 100644
--- a/glslwrite.c
+++ b/glslwrite.c
@@ -91,17 +91,27 @@ static void savePNG(int width, int height, const char *output_dir) {
}
static void usage(void) {
- fprintf(stderr, "Usage: glslwrite [-s <step>] [-f <frames>] [-0 <param0>] [-1 <param1>] [-2 <param2>] <shader>\n");
+ fprintf(stderr, "Usage: glslwrite [-w <width>] [-h <height>] [-s <step>] [-f <frames>] [-0 <param0>] [-1 <param1>] [-2 <param2>] <shader>\n");
exit(1);
}
int main(int argc, char *argv[]) {
+ int width = 800, height = 800;
+
while (true) {
- int c = getopt(argc, argv, "s:f:0:1:2:");
+ int c = getopt(argc, argv, "w:h:s:f:0:1:2:");
if (c == -1)
break;
switch (c) {
+ case 'w':
+ width = atoi(optarg);
+ break;
+
+ case 'h':
+ height = atoi(optarg);
+ break;
+
case 's':
step = atof(optarg);
break;
@@ -138,7 +148,7 @@ int main(int argc, char *argv[]) {
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
- SDL_Window *window = SDL_CreateWindow("glslwrite", 0, 0, 800, 800, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
+ SDL_Window *window = SDL_CreateWindow("glslwrite", 0, 0, width, height, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
SDL_GLContext ctx = SDL_GL_CreateContext(window);
filename = argv[optind];