Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: When transferring a framebuffer's texture to the screen, data is periodically lost

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2007
    Location
    Maryland
    Posts
    9

    When transferring a framebuffer's texture to the screen, data is periodically lost

    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.

    Code :
    	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
    Aaron

  2. #2
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,969

    Re: When transferring a framebuffer's texture to the screen, data is periodically lost

    Screenshot?

    It is difficult to understand what is going on from your description.

    Set color mask before your clear.
    Set texenv to GL_REPLACE (or equivalent).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •