diff --git a/img/mandelbrot_f128_limit.png b/img/mandelbrot_f128_limit.png
new file mode 100644
index 0000000..964a0ea
Binary files /dev/null and b/img/mandelbrot_f128_limit.png differ
diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index f4ef45d..b4a812f 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -1430,6 +1430,7 @@ sw buf_parse_fact (s_buf *buf, s_fact_w *dest)
sw buf_parse_fn (s_buf *buf, s_fn *dest)
{
+ bool macro = false;
sw r;
sw result = 0;
s_buf_save save;
@@ -1438,8 +1439,13 @@ sw buf_parse_fn (s_buf *buf, s_fn *dest)
assert(buf);
assert(dest);
buf_save_init(buf, &save);
- if ((r = buf_read_1(buf, "fn")) <= 0)
+ if ((r = buf_read_1(buf, "fn")) < 0)
goto clean;
+ if (! r) {
+ macro = true;
+ if ((r = buf_read_1(buf, "macro")) <= 0)
+ goto clean;
+ }
result += r;
fn_init(&tmp);
tail = &tmp.clauses;
@@ -1477,6 +1483,7 @@ sw buf_parse_fn (s_buf *buf, s_fn *dest)
result += r;
}
ok:
+ tmp.macro = macro;
*dest = tmp;
r = result;
goto clean;
diff --git a/libc3/window/sdl2/demo/mandelbrot_f128.c b/libc3/window/sdl2/demo/mandelbrot_f128.c
index e2936f8..2ebc909 100644
--- a/libc3/window/sdl2/demo/mandelbrot_f128.c
+++ b/libc3/window/sdl2/demo/mandelbrot_f128.c
@@ -172,11 +172,13 @@ bool mandelbrot_f128_render (s_sequence *seq)
*y = next_y;
*z = next_z;
}
+ glClearColor(0, 0, 0, 0);
+ glClear(GL_COLOR_BUFFER_BIT);
mat4_init_identity(&g_ortho.model_matrix);
gl_ortho_bind_texture(&g_ortho, g_mandelbrot_f128_texture);
gl_ortho_rect(&g_ortho, 0, 0, win->w, win->h);
gl_ortho_text_render_outline(&g_ortho, &g_mandelbrot_f128_text,
- 20.0, 120.0);
+ 20.0, 66.0);
return true;
}
@@ -203,6 +205,7 @@ static bool mandelbrot_f128_resize (s_sequence *seq)
return false;
if (! array_allocate(pixels))
return false;
+ printf("mandelbrot_f128_resize: %lux%lu\n", win->w, win->h);
return true;
}
@@ -218,6 +221,8 @@ bool mandelbrot_f128_unload (s_sequence *seq)
static bool mandelbrot_f128_update (s_sequence *seq)
{
f128 _2z_xz_y;
+ char a[512];
+ s_buf buf;
f128 c_x;
f128 c_y;
uw i;
@@ -294,14 +299,12 @@ static bool mandelbrot_f128_update (s_sequence *seq)
assert(glGetError() == GL_NO_ERROR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
assert(glGetError() == GL_NO_ERROR);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, win->w, win->h, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, pixels->data);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, win->w, win->h, 0,
+ GL_RGB, GL_UNSIGNED_BYTE, pixels->data);
assert(glGetError() == GL_NO_ERROR);
- char a[512];
- s_buf buf;
buf_init(&buf, false, sizeof(a), a);
buf_write_1(&buf, "x: ");
buf_inspect_f128(&buf, &next_x);
@@ -310,5 +313,6 @@ static bool mandelbrot_f128_update (s_sequence *seq)
buf_write_1(&buf, "\nz: ");
buf_inspect_f128(&buf, &next_z);
gl_text_update_buf(&g_mandelbrot_f128_text, &buf);
+ printf("mandelbrot_f128_update: %lux%lu\n", win->w, win->h);
return true;
}
diff --git a/libc3/window/sdl2/demo/window_sdl2_demo.c b/libc3/window/sdl2/demo/window_sdl2_demo.c
index 07d3c68..8571825 100644
--- a/libc3/window/sdl2/demo/window_sdl2_demo.c
+++ b/libc3/window/sdl2/demo/window_sdl2_demo.c
@@ -225,6 +225,7 @@ bool window_sdl2_demo_render (s_window_sdl2 *window)
seq = window->seq;
mat4_init_identity(&g_ortho.model_matrix);
gl_ortho_render(&g_ortho);
+ glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
diff --git a/libc3/window/sdl2/window_sdl2.c b/libc3/window/sdl2/window_sdl2.c
index a7d94ed..e036f14 100644
--- a/libc3/window/sdl2/window_sdl2.c
+++ b/libc3/window/sdl2/window_sdl2.c
@@ -131,6 +131,7 @@ s_window_sdl2 * window_sdl2_init (s_window_sdl2 *window,
bool window_sdl2_run (s_window_sdl2 *window)
{
SDL_GLContext context;
+ int mouse_x, mouse_y;
int quit = 0;
SDL_Event sdl_event;
SDL_Window *sdl_window;
@@ -255,6 +256,14 @@ bool window_sdl2_run (s_window_sdl2 *window)
quit = 1;
}
break;
+ case SDL_MOUSEWHEEL:
+ SDL_GetMouseState(&mouse_x, &mouse_y);
+ if (! window->button(window, sdl_event.wheel.y > 0 ? 4 : 5,
+ mouse_x, mouse_y)) {
+ err_puts("window_sdl2_run: window->button => false");
+ quit = 1;
+ }
+ break;
case SDL_MOUSEMOTION:
//int relativeX = sdl_event.motion.xrel;
//int relativeY = sdl_event.motion.yrel;