mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-04 10:40:09 -06:00
Make RenderablePlanet not crash if the nighttextures are not present
This commit is contained in:
@@ -292,16 +292,7 @@ bool RenderablePlanet::initialize() {
|
||||
LERROR(ss.str());
|
||||
}
|
||||
|
||||
loadTexture();
|
||||
|
||||
while ((err = glGetError()) != GL_NO_ERROR) {
|
||||
const GLubyte * errString = gluErrorString(err);
|
||||
std::stringstream ss;
|
||||
ss << "Error loading textures. OpenGL error: " << errString << std::endl;
|
||||
LERROR(ss.str());
|
||||
}
|
||||
|
||||
_geometry->initialize(this);
|
||||
_geometry->initialize(this);
|
||||
|
||||
_programObject->deactivate();
|
||||
|
||||
@@ -309,6 +300,8 @@ bool RenderablePlanet::initialize() {
|
||||
const GLubyte * errString = gluErrorString(err);
|
||||
LERROR("Shader Programs Creation. OpenGL error: " << errString);
|
||||
}
|
||||
|
||||
loadTexture();
|
||||
|
||||
return isReady();
|
||||
}
|
||||
@@ -394,13 +387,13 @@ void RenderablePlanet::render(const RenderData& data) {
|
||||
_programObject->setUniform("texture1", dayUnit);
|
||||
|
||||
// Bind possible night texture
|
||||
if (_hasNightTexture) {
|
||||
if (_hasNightTexture && _nightTexture) {
|
||||
nightUnit.activate();
|
||||
_nightTexture->bind();
|
||||
_programObject->setUniform("nightTex", nightUnit);
|
||||
}
|
||||
|
||||
if (_hasHeightTexture) {
|
||||
if (_hasHeightTexture && _heightMapTexture) {
|
||||
heightUnit.activate();
|
||||
_heightMapTexture->bind();
|
||||
_programObject->setUniform("heightTex", heightUnit);
|
||||
|
||||
@@ -46,7 +46,6 @@ public:
|
||||
bool initialize(Renderable* parent) override;
|
||||
void deinitialize() override;
|
||||
void render() override;
|
||||
PowerScaledSphere* _planet;
|
||||
|
||||
private:
|
||||
void createSphere();
|
||||
|
||||
Reference in New Issue
Block a user