trying to fix orthogonal projection issue.

This commit is contained in:
Michal Marcinkowski
2015-01-04 12:21:38 -05:00
parent ca39f5aaf5
commit 4e2edf2b2f
3 changed files with 12 additions and 13 deletions

View File

@@ -66,18 +66,17 @@ void main() {
vec4 raw_pos = psc_to_meter(vertex, _scaling);
vec4 projected = ProjectorMatrix * ModelTransform * raw_pos;
projected.x /= projected.w;
projected.y /= projected.w;
vec4 normal = normalize(ModelTransform * vec4(vertex.xyz,0));
vec3 normal = normalize(ModelTransform * vec4(vertex.xyz,0)).xyz;
//"in range"
if(inRange(projected.x, 0, 1) &&
inRange(projected.y, 0, 1) &&
dot(normal.xyz,vs_boresight) < -0.09 ){
color = texture(texture1, projected.xy);
// color.a = 1.0f;
if((inRange(projected.x, 0, 1) &&
inRange(projected.y, 0, 1)) &&
dot(normal, vs_boresight) < 0){
color = texture(texture1, projected.xy);
}else{
color = vec4(1,0,0,0);
}

View File

@@ -177,9 +177,9 @@ bool RenderablePlanetProjection::auxiliaryRendertarget(){
size, size, 0.0f, w, 1, 0,
};
glGenVertexArrays(1, &_quad); // generate array
glBindVertexArray(_quad); // bind array
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
glGenVertexArrays(1, &_quad); // generate array
glBindVertexArray(_quad); // bind array
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer); // bind buffer
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data), vertex_data, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
@@ -213,7 +213,7 @@ void RenderablePlanetProjection::imageProjectGPU(){
glGetIntegerv(GL_VIEWPORT, m_viewport);
static int counter = 0;
if (counter > 1){ // every something frame for now..
if (counter > 50){ // every something frame for now..
counter = 0;
glBindFramebuffer(GL_FRAMEBUFFER, _fboID);
// set blend eq