PDA

View Full Version : Background scrolling of rendered landscape



walter.weber-gross
10-16-2002, 12:18 PM
Hello,

is there a faster way to scroll a rendered background landscape which is much more larger than the screen than to render it each time again (using display lists) ?

Could it be better to rendering it once after startup into an auxiliary buffer (glDrawBuffer(GL_AUX0) e.g.) and then reading needed portions back into the front buffer (although i don't know yet how that works) ?

Think of backgrounds in games like Settlers or AoE2..

Thank you

Walter

JML
10-16-2002, 08:55 PM
Well, in general in OpenGL everything is redrawn each frame.

Perhaps you can tile the background and map it to a set of quads/tristrips that are properly culled when not visible.
Or you could draw just one screen-filling quad with correctly adjusted texture coordinates.

HTH

Jean-Marc

AdrianD
10-18-2002, 01:57 AM
Originally posted by walter.weber-gross:
Hello,

Could it be better to rendering it once after startup into an auxiliary buffer (glDrawBuffer(GL_AUX0) e.g.) and then reading needed portions back into the front buffer (although i don't know yet how that works) ?


this would not work. because AUX buffers are not widely supported.(i don't even know, if there is any HW supported implementation out there...)
BUT you can use the ARB_buffer_region or KTX_buffer_region extensions to save the whole framebuffer & depthbuffer in one call and restore them in the next frame.
you can even use an vertical and horizontal offset, when copying back. which means HW scrolling.

i used recently this in a game, which mixed huge prerendered screens(up to 4x of the actual screensize) with realtime characters and smooth scrolling. it works fine, but only if your 3d-card supports one of this extensions...

walter.weber-gross
10-18-2002, 11:05 AM
Thank you for your responses http://www.opengl.org/discussion_boards/ubb/smile.gif

Culling is an interesting item, but i think i will go deeper into detail with the WGL_ARB_buffer_region extension. It's likely to be that what i've been looking for.

zed
10-18-2002, 08:07 PM
i made a rts (like settlers/aoe) just treat the ground as a 3d scene (ie not as a 2d texture) even 2d games like settlers/aoe do this the ground is actually a collection of 1000's of small tiles + not one big picture

walter.weber-gross
10-19-2002, 01:30 AM
Building a huge 3D scene consisting of a lot of textured QUADS is what i'm already doing.

I simply thought, there could be a faster way to get that static landscape on the screen than that to render it each time. So the idea was to render and save it one time at startup and to copy portions of that image back to the screen as needed, when the player moves around, e.g.

As posted above, auxiliary buffers are seemingly not such a good idea, so i picked up the hint mentioned in a former posting to use the ARB_buffer_region extension (but GLX_* if there's any, instead of WGL_* as i wrote previously, cause i'm using Linux.. http://www.opengl.org/discussion_boards/ubb/wink.gif

But as not each OpenGL implementation has to support such extensions, i will also consider to continue with rendering each QUAD each time, as i do it already...

bye, bye