From 8de17b7542d4fde4551996d2e1cb32a7e992be13 Mon Sep 17 00:00:00 2001 From: TheCrazyT Date: Sat, 14 Jul 2018 08:22:12 +0200 Subject: [PATCH] fixing https://github.com/TheCrazyT/roboschool/issues/8 --- .bintray.js | 2 +- .travis_before_deploy | 1 + roboschool/cpp-household/render-simple.cpp | 24 ++++++++++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.bintray.js b/.bintray.js index bc48825..c7ae359 100644 --- a/.bintray.js +++ b/.bintray.js @@ -8,7 +8,7 @@ }, "version": { - "name": "0.4" + "name": "0.5" }, "files": diff --git a/.travis_before_deploy b/.travis_before_deploy index d801427..caec4af 100644 --- a/.travis_before_deploy +++ b/.travis_before_deploy @@ -372,6 +372,7 @@ echo PATH: %PATH% d:\Python36\python demo_race2.py pause EOL +cp roboschool/*.pyd build/ zip -r build/roboschool.zip rundemo.bat roboschool msysDLLs additionalDLLs agent_zoo -x ./roboschool/cpp-household/**\* zip -ru build/roboschool.zip ./roboschool/cpp-household/glsl/*.glsl if [ $? != 0 ] diff --git a/roboschool/cpp-household/render-simple.cpp b/roboschool/cpp-household/render-simple.cpp index e30970d..0436f7d 100644 --- a/roboschool/cpp-household/render-simple.cpp +++ b/roboschool/cpp-household/render-simple.cpp @@ -337,32 +337,40 @@ Texture::Texture() { glFuncs->glGenTextures(1, &handle); } Texture::~Texture() { - QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); - glFuncs->glDeleteTextures(1, &handle); + if(QOpenGLContext::currentContext() != NULL){ + QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); + glFuncs->glDeleteTextures(1, &handle); + } } Framebuffer::Framebuffer() { QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); glFuncs->glGenFramebuffers(1, &handle); } Framebuffer::~Framebuffer() { - QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); - glFuncs->glDeleteFramebuffers(1, &handle); + if(QOpenGLContext::currentContext() != NULL){ + QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); + glFuncs->glDeleteFramebuffers(1, &handle); + } } Buffer::Buffer() { QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); glFuncs->glGenBuffers(1, &handle); } Buffer::~Buffer() { - QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); - glFuncs->glDeleteBuffers(1, &handle); + if(QOpenGLContext::currentContext() != NULL){ + QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); + glFuncs->glDeleteBuffers(1, &handle); + } } VAO::VAO() { QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); glFuncs->glGenVertexArrays(1, &handle); } VAO::~VAO() { - QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); - glFuncs->glDeleteVertexArrays(1, &handle); + if(QOpenGLContext::currentContext() != NULL){ + QOpenGLExtraFunctions *glFuncs = QOpenGLContext::currentContext()->extraFunctions(); + glFuncs->glDeleteVertexArrays(1, &handle); + } } void ContextViewport::_render_single_object(const shared_ptr& m, uint32_t options, int detail, const QMatrix4x4& at_pos)