Make sure openGL state is reset after rendering globes

This commit is contained in:
Malin E
2023-03-21 13:53:05 +01:00
parent 103d1a11fc
commit f62d0bb677
3 changed files with 10 additions and 4 deletions

View File

@@ -48,6 +48,7 @@
#include <ghoul/misc/profiling.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/opengl/textureunit.h>
#include <ghoul/opengl/openglstatecache.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/systemcapabilities/openglcapabilitiescomponent.h>
#include <numeric>
@@ -807,6 +808,10 @@ void RenderableGlobe::render(const RenderData& data, RendererTasks& rendererTask
}
_lastChangedLayer = nullptr;
// Reset
global::renderEngine->openglStateCache().resetBlendState();
global::renderEngine->openglStateCache().resetDepthState();
}
void RenderableGlobe::renderSecondary(const RenderData& data, RendererTasks&) {

View File

@@ -55,7 +55,7 @@ public:
void pause();
void play();
void goToStart();
void seekToTime(double time, bool pauseAfter = false);
void toggleMute();
@@ -124,7 +124,7 @@ private:
// Video properties. Try to read all these values from the video
std::string _videoFile;
double _currentVideoTime = 0.0;
double _fps = 24.0; // If when we read it it is 0, use 24 fps
double _fps = 24.0; // If when we read it it is 0, use 24 fps
double _videoDuration = 0.0;
glm::ivec2 _videoResolution = glm::ivec2(2048, 1024); // Used for the fbos
bool _isPaused = false;

View File

@@ -29,10 +29,12 @@
#include <openspace/engine/syncengine.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/engine/windowdelegate.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/util/time.h>
#include <openspace/util/timemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/opengl/framebufferobject.h>
#include <ghoul/opengl/openglstatecache.h>
namespace {
constexpr std::string_view _loggerCat = "VideoPlayer";
@@ -530,8 +532,7 @@ void VideoPlayer::renderMpv() {
/* TODO: remove this comment in case we never encounter this issue again */
// We have to set the Viewport on every cycle because
// mpv_render_context_render internally rescales the fb of the context(?!)...
glm::ivec2 window = global::windowDelegate->currentDrawBufferResolution();
glViewport(0, 0, window.x, window.y);
global::renderEngine->openglStateCache().resetViewportState();
// We also need to reset the render target
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);