Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force glut to be down before doing glutInit #12

Merged
merged 1 commit into from
Mar 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/renderer3d_impl_glut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <GL/freeglut_ext.h>

#include "renderer3d_impl_glut.h"

Renderer3dImpl::Renderer3dImpl(const std::string & file_path, int width, int height) :
Renderer3dImplBase(file_path, width, height),
is_glut_initialized_(false)
Renderer3dImplBase(file_path, width, height)
{
};

Expand All @@ -69,12 +69,11 @@ Renderer3dImpl::set_parameters_low_level()
int argc = 0;
char **argv = 0;

// Start GLUT if it was not started before
//if (glutGet(GLUT_ELAPSED_TIME) <= 0)
if (!is_glut_initialized_) {
is_glut_initialized_ = true;
glutInit(&argc, argv);
}
// Make sure glut is down
glutExit();

// Initialize glut
glutInit(&argc, argv);

// By doing so, the window is not open
glutInitDisplayMode(GLUT_DOUBLE);
Expand Down
2 changes: 0 additions & 2 deletions src/renderer3d_impl_glut.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ class Renderer3dImpl : public Renderer3dImplBase
virtual void
bind_buffers() const;

/** States whether GLUT has been initialized or not */
bool is_glut_initialized_;
/** The frame buffer object used for offline rendering */
GLuint fbo_id_;
/** The render buffer object used for offline depth rendering */
Expand Down