Tiling multiple renders

Started by
3 comments, last by flamurai 18 years, 10 months ago
What's the easiest way to tile multiple renders? I was trying to do this with glViewport, but it gives me screwy results... doesn't even render one thing. Basically as a test I want to render an m-by-n grid of the same scene. This is what I tried:

for ( int i = 0; i < m; ++i )
{
  for ( int j = 0; j < n; ++j )
  {
    glViewport( w*i, h*j, w, h);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    // I also set up the camera and such here
    m_wndGL.Render( scene );
  }
}
If I unroll the loop as a test it doesn't work either unless I only render one thing. I think I'm on the wrong track.
Advertisement
TR - OpenGL Tile Rendering Library ^^

(basically, for each tile you'll need to set up projection matrix with something like glFrustum() call. Also, glClear() doesn't care about the viewport settings and would normally erase whole buffer, so you might want to call it just once before you start the for(...) loops.
Thanks... that's not exactly what I want to do, but maybe I can learn from it. Eventually, I want different scenes in the tiles, not to chop up a larger image.
Quote:Original post by flamurai
Eventually, I want different scenes in the tiles, not to chop up a larger image.

Ahh... in that case as long as you move that glClear() thing out of the loops so it stops destroing what you have drawn already, your approach should be fine -.^
Ah, I figured glClear would just clear the viewport. Bad assumption. I also had a bad semicolon that was throwing everything off, which made my problem seem more bizarre than it was.

This topic is closed to new replies.

Advertisement