Commit d21e273e731c4a7eaf866c769ca1d8ead03b86e2

Thomas de Grivel 2024-02-22T18:05:25

mandelbrot

diff --git a/.ic3_history b/.ic3_history
index c82d322..fa38750 100644
--- a/.ic3_history
+++ b/.ic3_history
@@ -1,10 +1,3 @@
-List.reverse([1, 2, 3])
-123 & 123
-123 | 123
-123 bor 123
-123 bor 0
-List.reverse([1, 2, 3])
-dlopen("libc3/window/.libs/libc3_window_debug.so")
 dlopen("libc3/window/sdl2/.libs/libc3_window_sdl2.so")
 %GL.Object{}
 name = "Plop"
@@ -97,3 +90,10 @@ if 1 2
 if
 if_then_else true 1 2
 if_then_else false 1 2
+if true && true
+  1 + 1
+  2 + 2
+else
+  3 + 3
+  4 + 4
+end
diff --git a/img/mandelbrot_f128_limit.1.png b/img/mandelbrot_f128_limit.1.png
new file mode 100644
index 0000000..4706ca3
Binary files /dev/null and b/img/mandelbrot_f128_limit.1.png differ
diff --git a/libc3/window/sdl2/demo/mandelbrot_f128.c b/libc3/window/sdl2/demo/mandelbrot_f128.c
index 2ebc909..147d73c 100644
--- a/libc3/window/sdl2/demo/mandelbrot_f128.c
+++ b/libc3/window/sdl2/demo/mandelbrot_f128.c
@@ -54,7 +54,7 @@ bool mandelbrot_f128_button (s_sequence *seq, u8 button, sw x, sw y)
   next_z = &map->value[3].data.f128;
   if (button == 1) {
     *next_x = *next_x + *next_z * (x - (f128) win->w / 2);
-    *next_y = *next_y + *next_z * (y - (f128) win->h / 2);
+    *next_y = *next_y + *next_z * ((f128) win->h / 2 - y);
   }
   else if (button == 5) {
     *next_z = *next_z * exp2l(0.5);
@@ -106,6 +106,9 @@ bool mandelbrot_f128_load (s_sequence *seq)
                        "z: 0.01"))
     return false;
   gl_text_update(&g_mandelbrot_f128_text);
+  assert(glGetError() == GL_NO_ERROR);
+  glGenTextures(1, &g_mandelbrot_f128_texture);
+  assert(glGetError() == GL_NO_ERROR);
   return true;
 }
 
@@ -289,6 +292,7 @@ static bool mandelbrot_f128_update (s_sequence *seq)
       pix[0] = level;
       pix[1] = level;
       pix[2] = level;
+      pix[3] = 255;
       pix += 4;
       j++;
     }
@@ -302,8 +306,8 @@ static bool mandelbrot_f128_update (s_sequence *seq)
   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_RGB, win->w, win->h, 0,
-               GL_RGB, GL_UNSIGNED_BYTE, pixels->data);
+  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, win->w, win->h, 0,
+               GL_RGBA, GL_UNSIGNED_BYTE, pixels->data);
   assert(glGetError() == GL_NO_ERROR);
   buf_init(&buf, false, sizeof(a), a);
   buf_write_1(&buf, "x: ");