Fixes for Mac rendering of stars and milkyway

This commit is contained in:
Alexander Bock
2015-05-14 12:50:17 +02:00
parent 8f5ba101e4
commit 6a9fdef2e0
5 changed files with 38 additions and 11 deletions

View File

@@ -39,8 +39,8 @@ void main()
{
vec4 position = vs_position;
// This has to be fixed with the ScaleGraph in place (precision deficiency in depth buffer) ---abock
// float depth = pscDepth(position);
float depth = 1000.0;
//float depth = pscDepth(position);
float depth = 0.1;
vec4 diffuse;
vec2 texCoord = vs_st;
@@ -71,7 +71,7 @@ void main()
// diffuse = vec4(0.0);
// #endif
// diffuse = vec4(1.0, 0.0, 0.0, 1.0);
//diffuse = vec4(1.0, 0.0, 0.0, 1.0);
ABufferStruct_t frag = createGeometryFragment(diffuse, position, depth);
addToBuffer(frag);

View File

@@ -91,4 +91,7 @@ void main() {
ABufferStruct_t frag = createGeometryFragment(fullColor, position, depth);
addToBuffer(frag);
if (fullColor.a == 0)
discard;
}

View File

@@ -186,9 +186,7 @@ void RenderableSphere::update(const UpdateData& data) {
}
void RenderableSphere::loadTexture() {
LDEBUG("loadTexture");
if (_texturePath.value() != "") {
LDEBUG("loadTexture2");
ghoul::opengl::Texture* texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath));
if (texture) {
LDEBUG("Loaded texture from '" << absPath(_texturePath) << "'");

View File

@@ -174,8 +174,9 @@ bool RenderableStars::deinitialize() {
}
void RenderableStars::render(const RenderData& data) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
//glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
glDisable(GL_DEPTH_TEST);
_program->activate();
@@ -221,7 +222,8 @@ void RenderableStars::render(const RenderData& data) {
_program->setIgnoreUniformLocationError(false);
_program->deactivate();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_DEPTH_TEST);
}
void RenderableStars::update(const UpdateData& data) {

View File

@@ -44,8 +44,6 @@ namespace {
namespace openspace {
SceneGraph::SceneGraph() {
}
void SceneGraph::clear() {
@@ -266,7 +264,7 @@ bool SceneGraph::loadFromFile(const std::string& sceneDescription) {
LERROR("Topological sort failed");
return false;
}
return true;
}
@@ -316,6 +314,32 @@ bool SceneGraph::sortTopologially() {
}
#ifdef __APPLE__
auto it = std::find_if(
_topologicalSortedNodes.begin(),
_topologicalSortedNodes.end(),
[](SceneGraphNode* node) {
return node->name() == "Stars";
}
);
SceneGraphNode* n = *it;
_topologicalSortedNodes.erase(it);
_topologicalSortedNodes.insert(_topologicalSortedNodes.begin() + 3, n);
it = std::find_if(
_topologicalSortedNodes.begin(),
_topologicalSortedNodes.end(),
[](SceneGraphNode* node) {
return node->name() == "MilkyWay";
}
);
n = *it;
_topologicalSortedNodes.erase(it);
_topologicalSortedNodes.insert(_topologicalSortedNodes.begin() + 2, n);
#endif
return true;
}