diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-09-17 16:15:14 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-02-16 17:30:43 +0300 |
commit | f059bdc82311e79a2b60f9af9154ac7822fd7001 (patch) | |
tree | f64d82673f6c38a763af183f12d52bba98325df3 /intern/cycles/app/cycles_standalone.cpp | |
parent | 54972123f73ac2d4674efc5fa07fbf372c5bb4f6 (diff) |
Cycles: restore basic standalone GUI, now using SDL
GLUT does not support offscreen contexts, which is required for the new
display driver. So we use SDL instead. Note that this requires using a
system SDL package, the Blender precompiled SDL does not include the video
subsystem.
There is currently no text display support, instead info is printed to
the terminal. This would require adding an embedded font and GLSL shaders,
or using GUI library.
Another improvement to be made is supporting OpenColorIO display transforms,
right now we assume Rec.709 scene linear and display.
All OpenGL, GLEW and SDL code was move out of core cycles and into
app/opengl. This serves as a template for apps that want to integrate
Cycles interactive rendering, with a simple OpenGLDisplayDriver example.
In general this would be adapted to the graphics API and color management
used by the app.
Ref T91846
Diffstat (limited to 'intern/cycles/app/cycles_standalone.cpp')
-rw-r--r-- | intern/cycles/app/cycles_standalone.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp index 7123edbef64..ef514be4369 100644 --- a/intern/cycles/app/cycles_standalone.cpp +++ b/intern/cycles/app/cycles_standalone.cpp @@ -40,11 +40,10 @@ #include "app/oiio_output_driver.h" #ifdef WITH_CYCLES_STANDALONE_GUI -# include "util/view.h" +# include "opengl/display_driver.h" +# include "opengl/window.h" #endif -#include "app/cycles_xml.h" - CCL_NAMESPACE_BEGIN struct Options { @@ -130,7 +129,14 @@ static void session_init() options.output_pass = "combined"; options.session = new Session(options.session_params, options.scene_params); - if (!options.output_filepath.empty()) { +#ifdef WITH_CYCLES_STANDALONE_GUI + if (!options.session_params.background) { + options.session->set_display_driver(make_unique<OpenGLDisplayDriver>( + window_opengl_context_enable, window_opengl_context_disable)); + } + else +#endif + if (!options.output_filepath.empty()) { options.session->set_output_driver(make_unique<OIIOOutputDriver>( options.output_filepath, options.output_pass, session_print)); } @@ -139,7 +145,7 @@ static void session_init() options.session->progress.set_update_callback(function_bind(&session_print_status)); #ifdef WITH_CYCLES_STANDALONE_GUI else - options.session->progress.set_update_callback(function_bind(&view_redraw)); + options.session->progress.set_update_callback(function_bind(&window_redraw)); #endif /* load scene */ @@ -204,10 +210,10 @@ static void display_info(Progress &progress) sample_time, interactive.c_str()); - view_display_info(str.c_str()); + window_display_info(str.c_str()); if (options.show_help) - view_display_help(); + window_display_help(); } static void display() @@ -538,15 +544,15 @@ int main(int argc, const char **argv) string title = "Cycles: " + path_filename(options.filepath); /* init/exit are callback so they run while GL is initialized */ - view_main_loop(title.c_str(), - options.width, - options.height, - session_init, - session_exit, - resize, - display, - keyboard, - motion); + window_main_loop(title.c_str(), + options.width, + options.height, + session_init, + session_exit, + resize, + display, + keyboard, + motion); } #endif |