summaryrefslogtreecommitdiffstats
path: root/glslwrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'glslwrite.c')
-rw-r--r--glslwrite.c16
1 files changed, 13 insertions, 3 deletions
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];