Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Streaks

I'm getting strange streaks on my cube map when rendering to it. He is my code that is being called each frame:

void drawCubeMap(void)
{


int face;
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glBindFramebuffer(GL_FRAMEBUFFER, fbo);
//glBindTexture(GL_TEXTURE_CUBE_MAP, cubeMapTexture);
//glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glViewport(0,0,sizeT, sizeT);

for (face = 0; face < 6; face++) {

   glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, cubeMapTexture, 0);
   drawSpheres();
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindTexture(GL_TEXTURE_2D, 0);
glViewport(0,0,900, 900);
}

Any idea what it might be? The streaking occurs when I'm rotating the spheres around the main sphere.

share|improve this question
2  
How is that large black ball representing a cube map? –  Daniel Nov 10 '11 at 4:50
1  
I'm not familiar with framebuffer objects, but don't you need to glClear every scene you draw, i.e. within the face loop? Those streaks look like overlaid copies due to not clearing the color buffer. –  Kevin Reid Nov 10 '11 at 16:12
    
I'll try that, but each draw call in the loop is rendering to a different section of the cube map. –  Joey Green Nov 10 '11 at 16:15
    
Daniel, I'm just attaching the cube map to the object without color or any additional textures. I haven't changed the viewport for each call yet, because I'm trying to figure out this problem first. –  Joey Green Nov 10 '11 at 16:17
1  
You're rendering 6 views for the cubemap, so you should be clearing it 6 times. Also, I wonder what GLClearColor would do if you uncommented it, moved it into the loop and set it to a black color? –  ChrisC Nov 10 '11 at 18:50

1 Answer 1

up vote 1 down vote accepted

Since you're rendering six images to the cube map, you should set the glClear and glClearColor inside of the loop, clearing it six times. In this case, the clear color should be black, so it keeps a black background.

The same principle applies to any dynamic environment mapping techniques you use, be it a cube map, dual paraboloid map, etc.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.