mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-08 04:31:08 -06:00
Feature/globals handling (#1352)
* Cleaner handling of global state * Prevent Lua memory corruption (closes #982) * Initialize glfw first thing to prevent weird joystick loading bug during startup
This commit is contained in:
@@ -78,7 +78,7 @@ ScreenSpaceFramebuffer::ScreenSpaceFramebuffer(const ghoul::Dictionary& dictiona
|
||||
setGuiName("ScreenSpaceFramebuffer " + std::to_string(iIdentifier));
|
||||
}
|
||||
|
||||
glm::vec2 resolution = global::windowDelegate.currentDrawBufferResolution();
|
||||
glm::vec2 resolution = global::windowDelegate->currentDrawBufferResolution();
|
||||
addProperty(_size);
|
||||
_size.set(glm::vec4(0, 0, resolution.x,resolution.y));
|
||||
}
|
||||
@@ -104,7 +104,7 @@ bool ScreenSpaceFramebuffer::deinitializeGL() {
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::render() {
|
||||
const glm::vec2& resolution = global::windowDelegate.currentDrawBufferResolution();
|
||||
const glm::vec2& resolution = global::windowDelegate->currentDrawBufferResolution();
|
||||
const glm::vec4& size = _size.value();
|
||||
|
||||
const float xratio = resolution.x / (size.z - size.x);
|
||||
@@ -113,14 +113,14 @@ void ScreenSpaceFramebuffer::render() {
|
||||
if (!_renderFunctions.empty()) {
|
||||
GLint viewport[4];
|
||||
//glGetIntegerv(GL_VIEWPORT, viewport);
|
||||
global::renderEngine.openglStateCache().viewport(viewport);
|
||||
global::renderEngine->openglStateCache().viewport(viewport);
|
||||
glViewport(
|
||||
static_cast<GLint>(-size.x * xratio),
|
||||
static_cast<GLint>(-size.y * yratio),
|
||||
static_cast<GLsizei>(resolution.x * xratio),
|
||||
static_cast<GLsizei>(resolution.y * yratio)
|
||||
);
|
||||
global::renderEngine.openglStateCache().setViewportState(viewport);
|
||||
global::renderEngine->openglStateCache().setViewportState(viewport);
|
||||
|
||||
GLint defaultFBO = _framebuffer->getActiveObject();
|
||||
_framebuffer->activate();
|
||||
@@ -171,7 +171,7 @@ void ScreenSpaceFramebuffer::removeAllRenderFunctions() {
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::createFramebuffer() {
|
||||
glm::vec2 resolution = global::windowDelegate.currentDrawBufferResolution();
|
||||
glm::vec2 resolution = global::windowDelegate->currentDrawBufferResolution();
|
||||
|
||||
_framebuffer = std::make_unique<ghoul::opengl::FramebufferObject>();
|
||||
_framebuffer->activate();
|
||||
|
||||
Reference in New Issue
Block a user