matus-chochlik / oglplus

OGLplus is a collection of open-source, cross-platform libraries which implement an object-oriented facade over the OpenGL® (version 3 and higher) and also OpenAL® (version 1.1) and EGL (version 1.4) C-language APIs. It provides wrappers which automate resource and object management and make the use of these libraries in C++ safer and more convenient.
http://oglplus.org/
Boost Software License 1.0
492 stars 72 forks source link

premature exit of example programs in Fedora 27? #139

Open bengland2 opened 6 years ago

bengland2 commented 6 years ago

I got many of oglplus example programs to build on my Fedora 27 system, but when I run them, they seem to spontaneously exit without my pressing any keys or mouse button. There is nothing in the code that suggests they should do this because of a timer, etc. Has anyone seen them? I do see some messages like:

<message>  multisampled FBO 0-&gt;1
</message>

but nothing that looks like an error. Nothing is logged to dmesg or journalctl -fa. No core dump. For example, _build/example/oglplus/001_triangle exits within 4 seconds. What's going on?

Here was how I built:

./configure.sh --no-docs --build --install 2>&1 | tee cfg.log

and here is the log. these RPMs are installed (whatever version is current in F27 now, versions available upon request).

glfw-devel glew-devel glm-devel libpng12-devel libpng-devel boost-devel mesa-libGL-devel mesa-libGLU-devel mesa libGLES-devel

When it does work, the graphics are really neat and put very low load on my CPU showing that shaders are doing their job.

matus-chochlik commented 6 years ago

Hi Ben,

Many of the examples do "timeout" in the Example::Continue member function which by default (see: https://github.com/matus-chochlik/oglplus/blob/develop/example/oglplus/example.hpp#L277) indicates that the example should quit after 3 seconds.

bengland2 commented 6 years ago

Yeah that was lazy of me . Still, it would be nice to have a log message in there saying why it is exiting, more like:

diff --git a/example/oglplus/example.hpp b/example/oglplus/example.hpp
index 53ba72cd..198ebfe4 100644
--- a/example/oglplus/example.hpp
+++ b/example/oglplus/example.hpp
@@ -243,6 +243,8 @@ std::unique_ptr<ExampleThread> makeExampleThread(
        const ExampleParams& params
 );

+#define DEFAULT_EXIT_TIMEOUT 300.0
+
 /// Base class for OGLplus examples
 class Example
 {
@@ -266,7 +268,12 @@ public:
         */
        virtual bool Continue(double duration)
        {
-               return duration < 3.0; // [seconds]
+               if (duration < DEFAULT_EXIT_TIMEOUT) { // [seconds]
+                       return true;
+               } else {
+                       std::cout << "default timeout is " << DEFAULT_EXIT_TIMEOUT << std::endl;
+                       return false;
+               }
        }

        /// Hint for the main function whether to continue rendering

I couldn't figure out how to do it with a static const member var because there is no example.cpp.

matus-chochlik commented 6 years ago

Hi,

I'll have a look at this, but I'll probably integrate it with the GL debug logging framework if possible. Also the default timeout is intentionally so short. In the rewrite of OGLplus the timeout can be postponed by the user moving the mouse, I'll have a look at that and maybe do the same here.