I am rendering to a offscreen unclamped color texture. I am able to successfully read the data using glReadPixels. The problem I am having occurrs when I want to take that texture and bind it to the on-screen framebuffer. When I do that and use a fragment shader that converts the unclamped color to your normal RGB value, sections of the texture are not mapped to the on-screen buffer periodically when I sweep through different rotations of the object.
cgBindPrograms(0,6);
CGparameter imageParam =
cgGetNamedProgramParameter(cgGetFragmentProgram(6),CG_PROGRAM,"texImage");
cgGLSetTextureParameter(imageParam,m_texture[IMAGE_IDX].id);
cgGLEnableTextureParameter(imageParam);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,0);
glDrawBuffer(GL_BACK); // write texture
glShadeModel(GL_FLAT);
glClearDepth(1E8);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE,GL_ONE); // full additive blending
// create a quad to cover the entire view area
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glBegin(GL_QUADS);
glTexCoord2f(m_clipBoundary.min.x,m_clipBoundary.min.y);
glVertex2f(m_clipBoundary.min.x,m_clipBoundary.min.y);
glTexCoord2f(m_clipBoundary.max.x,m_clipBoundary.min.y);
glVertex2f(m_clipBoundary.max.x,m_clipBoundary.min.y);
glTexCoord2f(m_clipBoundary.max.x,m_clipBoundary.max.y);
glVertex2f(m_clipBoundary.max.x,m_clipBoundary.max.y);
glTexCoord2f(m_clipBoundary.min.x,m_clipBoundary.max.y);
glVertex2f(m_clipBoundary.min.x,m_clipBoundary.max.y);
glEnd();
glXWaitGL();
glXSwapBuffers(m_pDisplay, m_window);
glDisable(m_texture[IMAGE_IDX].target);
cgGLDisableTextureParameter(imageParam);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,m_fo.id);
}
Any help will be greatly appreciated. Thanks,
Aaron