Fix bug of stretched texture of the renderable sky browser

This commit is contained in:
Ylva Selling
2021-05-20 11:41:25 +02:00
parent 27ac366782
commit 37c7737c55
2 changed files with 5 additions and 6 deletions
@@ -53,7 +53,6 @@ namespace openspace {
void executeJavascript(std::string script) const;
bool sendMessageToWWT(const ghoul::Dictionary& msg);
protected:
properties::Vec2Property _dimensions;
@@ -79,7 +78,6 @@ namespace openspace {
CefRefPtr<WebKeyboardHandler> _keyboardHandler;
glm::ivec2 _objectSize = glm::ivec2(0);
bool _isUrlDirty = false;
bool _isDimensionsDirty = false;
@@ -109,12 +109,14 @@ namespace openspace {
_texture = std::make_unique<ghoul::opengl::Texture>(
glm::uvec3(_dimensions.value(), 1.0f)
);
_texture->setDimensions(glm::ivec3(_dimensions.value(), 1));
_renderHandler->setTexture(*_texture);
// The browser gets by default the size of the OpenSpace window, so it needs to
// be resized
_browserInstance->initialize();
_browserInstance->loadUrl(_url);
_dimensions = _texture->dimensions();
_browserInstance->reshape(_dimensions.value());
}
void RenderableSkyBrowser::deinitializeGL() {
@@ -143,7 +145,6 @@ namespace openspace {
void RenderableSkyBrowser::update(const UpdateData& data) {
RenderablePlane::update(data);
_renderHandler->updateTexture();
_objectSize = _texture->dimensions();
if (_isUrlDirty) {
_browserInstance->loadUrl(_url);