mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 19:50:03 -06:00
fix bugs in fisheye rendering
This commit is contained in:
@@ -232,6 +232,10 @@ bool RenderableModelProjection::initialize() {
|
||||
bool RenderableModelProjection::auxiliaryRendertarget() {
|
||||
bool completeSuccess = true;
|
||||
// set FBO to texture to project to
|
||||
|
||||
GLint defaultFBO;
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
|
||||
|
||||
glGenFramebuffers(1, &_fboID);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, _fboID);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, *_texture, 0);
|
||||
@@ -240,7 +244,7 @@ bool RenderableModelProjection::auxiliaryRendertarget() {
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
completeSuccess &= false;
|
||||
// switch back to window-system-provided framebuffer
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
||||
|
||||
int vertexSize = sizeof(modelgeometry::ModelGeometry::Vertex);
|
||||
|
||||
|
||||
@@ -271,6 +271,10 @@ bool RenderablePlanetProjection::initialize() {
|
||||
bool RenderablePlanetProjection::auxiliaryRendertarget(){
|
||||
bool completeSuccess = true;
|
||||
if (!_texture) return false;
|
||||
|
||||
GLint defaultFBO;
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
|
||||
|
||||
// setup FBO
|
||||
glGenFramebuffers(1, &_fboID);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, _fboID);
|
||||
@@ -280,7 +284,7 @@ bool RenderablePlanetProjection::auxiliaryRendertarget(){
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
completeSuccess &= false;
|
||||
// switch back to window-system-provided framebuffer
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
||||
|
||||
// SCREEN-QUAD
|
||||
const GLfloat size = 1.0f;
|
||||
@@ -384,7 +388,7 @@ void RenderablePlanetProjection::imageProjectGPU(){
|
||||
glBindVertexArray(_quad);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
_fboProgramObject->deactivate();
|
||||
glDisable(GL_BLEND);
|
||||
//glDisable(GL_BLEND);
|
||||
|
||||
//bind back to default
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
||||
|
||||
@@ -272,7 +272,14 @@ bool RenderEngine::initializeGL() {
|
||||
//#endif
|
||||
const glm::vec3 eyePosition = sgct_core::ClusterManager::instance()->getDefaultUserPtr()->getPos();
|
||||
// get viewdirection, stores the direction in the camera, used for culling
|
||||
const glm::vec3 viewdir = glm::normalize(eyePosition - center);
|
||||
glm::vec3 viewdir = eyePosition - center;
|
||||
|
||||
if (viewdir == glm::vec3(0)) {
|
||||
viewdir = glm::vec3(0, 0, 1);
|
||||
} else {
|
||||
viewdir = glm::normalize(viewdir);
|
||||
}
|
||||
|
||||
_mainCamera->setCameraDirection(-viewdir);
|
||||
_mainCamera->setLookUpVector(glm::vec3(0.0, 1.0, 0.0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user