Results 1 to 4 of 4

Thread: Memory issue in offscreen rendering

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    2

    Memory issue in offscreen rendering

    Hi

    I face a problem with texture rendering in offscreen rendering mode. I have a huge set of vertices (formed by accumulation) rendered onto an FBO. The vertex structure includes actual vertices, texture vertices and the color data. When the total number of indices exceeds a certain limit the frame is not drawn. Neither does it throw any glError. It is not the number of indices drawn at one stretch, but the total number of indices for the entire frame when exceeds a certain limit gives the problem. I do delete the vbo-s created as and when it is rendered. Can someone tell me what might be the cause of this problem. Is there something that I am missing out.

    The same code works properly when rendered directly onto the surface instead of FBO. Also the problem occurs only in Motorola Milestone and works properly with Samsung Galaxy Tab.
    Code :
     
            glEnable( GL_TEXTURE_2D);
    	glEnableClientState(GL_COLOR_ARRAY);
     
    	glVertexPointer(3, GL_FLOAT, 0, vertexArray);
    	glTexCoordPointer(2, GL_FLOAT, 0, texArray);
    	glColorPointer(4, GL_UNSIGNED_BYTE, 0, colorArray);
     
    	glBindTexture(GL_TEXTURE_2D, *m_OuterTexture);
    	glDrawElements(GL_TRIANGLES, iNumIndices, GL_UNSIGNED_SHORT, pauiNewIndices);
    	checkGlError("draw tess 1");
     
    	if( bFillInner )
    	{
    		glBindTexture(GL_TEXTURE_2D, *m_InnerTexture);
    		glDrawElements(GL_TRIANGLES, iNumLines * 18, GL_UNSIGNED_SHORT, pauiNewIndices);
    		checkGlError("draw tess 2");
    	}
     
    	glDisable( GL_TEXTURE_2D);

  2. #2
    Senior Member
    Join Date
    May 2010
    Posts
    207

    Re: Memory issue in offscreen rendering

    I think your problem must lie elsewhere. The system should allow you to render an unlimited number of vertices per frame. The problem doesn't even make sense...I mean, once the system has rendered a bunch of vertices, they have turned into pixels in the frame buffer. There is no place in the system that "remembers" things you already drew.

    So my bet is that you have some other bug and it's just crashing the thing at this point by chance.

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    2

    Re: Memory issue in offscreen rendering

    But as I told you, the same code works on Galaxy tab which has a better configuration. So I thought the problem might lie with memory. And could it be possible that the gl calls got accumulated and were not pushed to GPU till then. Because somewhere I read that PowerVR does an internal optimization by accumulating all gl calls and pushes it right before the buffer gets swapped. Does that have anything to do with this?

    But I also tried giving a glFinish call at the end of each glDrawElement. It dint work out.

    Also, if I just comment out the binding and drawing of second texture the limit on number of indices is relaxed a bit. Say previously the frame got rendered only for X indices. Now it renders for some X+Y. But not beyond that.

  4. #4
    Senior Member
    Join Date
    May 2010
    Posts
    207

    Re: Memory issue in offscreen rendering

    I suppose that's possible - and if so, a bug in their driver could certainly cause a bug like this.

    Perhaps sticking a gl.flush(); into your code every few thousand draw calls would help?

    But if this is the problem, it's definitely a driver bug - WebGL/OpenGL/Direct3D don't limit the number of triangles you can draw when they are implemented correctly.

    -- Steve

Similar Threads

  1. constant memory issue
    By roger512 in forum OpenCL
    Replies: 4
    Last Post: 05-08-2013, 11:29 AM
  2. Offscreen rendering with pbuffers in es 2.0
    By freber in forum OpenGL ES general technical discussions
    Replies: 2
    Last Post: 09-18-2007, 12:15 AM

Posting Permissions

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