aboutsummaryrefslogtreecommitdiff
path: root/src/mandelbrot-zoom.c
diff options
context:
space:
mode:
authorLeonard Kugis <leonardkugis@gmail.com>2018-01-23 01:08:38 +0100
committerLeonard Kugis <leonardkugis@gmail.com>2018-01-23 01:08:38 +0100
commit8e5bc917659288a257d5de9827458039f5498ef5 (patch)
tree23adb70c5e1e8b7aa53f9a604f21987ba89d15a4 /src/mandelbrot-zoom.c
parentfe610572ba73898ce159fb70b9fa9a4cccffd331 (diff)
OpenGL rendering added, cleaned up paths
Diffstat (limited to 'src/mandelbrot-zoom.c')
-rw-r--r--src/mandelbrot-zoom.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mandelbrot-zoom.c b/src/mandelbrot-zoom.c
index bd97b66..e208940 100644
--- a/src/mandelbrot-zoom.c
+++ b/src/mandelbrot-zoom.c
@@ -11,14 +11,18 @@ int main(int argc, char **argv)
{
GtkBuilder *builder;
gtk_init(&argc, &argv);
+ glutInit(&argc, argv);
builder = gtk_builder_new();
gtk_builder_add_from_file (builder, "glade/settings.glade", NULL); // TODO: Glade-Zeug mit in die exe
ui_settings.settings = GTK_WINDOW(gtk_builder_get_object(builder, "settings"));
//gtk_builder_connect_signals(builder, NULL);
ui_settings.iterationsSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "iterationsSp"));
+ ui_settings.threadsSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "threadsSp"));
ui_settings.colorFromBtn = GTK_BUTTON(gtk_builder_get_object(builder, "colorFromBtn"));
ui_settings.colorToBtn = GTK_BUTTON(gtk_builder_get_object(builder, "colorToBtn"));
+ ui_settings.zoomToXEntry = GTK_ENTRY(gtk_builder_get_object(builder, "zoomToXEntry"));
+ ui_settings.zoomToYEntry = GTK_ENTRY(gtk_builder_get_object(builder, "zoomToYEntry"));
ui_settings.exportCb = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "exportCb"));
ui_settings.gifRd = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "gifRd"));
ui_settings.widthSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "widthSp"));
@@ -32,6 +36,7 @@ int main(int argc, char **argv)
ui_settings.colorDialog = GTK_COLOR_SELECTION_DIALOG(gtk_builder_get_object(builder, "colorDialog"));
gtk_spin_button_set_increments(ui_settings.iterationsSp, 1, 2);
+ gtk_spin_button_set_increments(ui_settings.threadsSp, 1, 2);
gtk_spin_button_set_increments(ui_settings.widthSp, 1, 2);
gtk_spin_button_set_increments(ui_settings.heightSp, 1, 2);
gtk_spin_button_set_increments(ui_settings.fpsRenderSp, 1, 2);
@@ -39,6 +44,7 @@ int main(int argc, char **argv)
gtk_spin_button_set_increments(ui_settings.bitrateSp, 1, 2);
gtk_spin_button_set_value(ui_settings.iterationsSp, 1000);
+ gtk_spin_button_set_value(ui_settings.threadsSp, 4);
gtk_spin_button_set_value(ui_settings.widthSp, 1920);
gtk_spin_button_set_value(ui_settings.heightSp, 1080);
gtk_spin_button_set_value(ui_settings.fpsRenderSp, 30);
@@ -46,6 +52,7 @@ int main(int argc, char **argv)
gtk_spin_button_set_value(ui_settings.bitrateSp, 1000);
gtk_spin_button_set_range(ui_settings.iterationsSp, 1, 16777215); // 3 bytes á 8 bit = 24 bit
+ gtk_spin_button_set_range(ui_settings.threadsSp, 1, 255);
gtk_spin_button_set_range(ui_settings.widthSp, 1, 1920);
gtk_spin_button_set_range(ui_settings.heightSp, 1, 1080);
gtk_spin_button_set_range(ui_settings.fpsRenderSp, 1, 60);
@@ -53,6 +60,7 @@ int main(int argc, char **argv)
gtk_spin_button_set_range(ui_settings.bitrateSp, 1, 65535);
g_signal_connect(ui_settings.iterationsSp, "value-changed", G_CALLBACK(on_iterationsSp_valueChanged), NULL);
+ g_signal_connect(ui_settings.threadsSp, "value-changed", G_CALLBACK(on_threadsSp_valueChanged), NULL);
g_signal_connect(ui_settings.colorFromBtn, "clicked", G_CALLBACK(on_colorFromBtn_clicked), NULL);
g_signal_connect(ui_settings.colorToBtn, "clicked", G_CALLBACK(on_colorToBtn_clicked), NULL);
g_signal_connect(ui_settings.exportCb, "toggled", G_CALLBACK(on_exportCb_toggled), NULL);
@@ -76,6 +84,11 @@ void on_iterationsSp_valueChanged()
config.iterations = gtk_spin_button_get_value(ui_settings.iterationsSp);
}
+void on_threadsSp_valueChanged()
+{
+ config.threads = gtk_spin_button_get_value(ui_settings.threadsSp);
+}
+
void on_colorFromBtn_clicked()
{
currentColor = COLOR_FROM;
@@ -125,7 +138,12 @@ void on_bitrateSp_valueChanged()
void on_startBtn_clicked()
{
- printf("config {\n\t.iterations = %u\n\t.video = %u\n\t.filetype = %u\n\t.width = %u\n\t.height = %u\n\t.renderFPS = %u\n\t.videoFPS = %u\n\t.bitrate = %u\n\t.path = %s\n}\n", config.iterations, config.video, 0, config.width, config.height, config.renderFPS, config.videoFPS, config.bitrate, config.path);
+ double x, y;
+ sscanf(gtk_entry_get_text(ui_settings.zoomToXEntry), "%lf", &x);
+ sscanf(gtk_entry_get_text(ui_settings.zoomToYEntry), "%lf", &y);
+ config.to_x = x;
+ config.to_y = y;
+ printf("config {\n\t.iterations = %u\n\t.tox = %f\n\t.toy = %f\n\t.video = %u\n\t.filetype = %u\n\t.width = %u\n\t.height = %u\n\t.renderFPS = %u\n\t.videoFPS = %u\n\t.bitrate = %u\n\t.path = %s\n}\n", config.iterations, x, y, config.video, 0, config.width, config.height, config.renderFPS, config.videoFPS, config.bitrate, config.path);
render_init(&config, mandelbrot_r);
render_show();
}