Rendering System

Rendering System of SecondLife Viewer 1.22

The SecondLife Viewer uses OpenGL to interface with the graphics hardware.

Rendering in the viewer starts in llviewerdisplay.cpp in the display() method.

Rendering follows this flow of events:

Don't render if window is minimized.

Don't render if client is in startup state.

If client is in teleport mode only draw a static screen and progress bar.

If client requested a logout don't draw anything else.

prepare for next frame:

update window and dynamic textures:

for each dynamic texture:

-> save camera and viewport and clear the depthbuffer if required

-> render to framebuffer

-> use glCopyTexSubImage2D to copy results to texture

-> restore camera and viewport

update scene:

display_camera_update() creates projection matrix and clip distance

Seems just to remove dead pools from the list of pools.

Redraws skytexture and cubic environment map.

draw geometry

unbind vertex buffers (?)

set safe default state values (matrices and stuff)

set fog and lights

render drawpools

Drawpools represent either a set of polygons (LLFacePool) or a renderpass (LLRenderPass). There are different types of either kind.

Facepools are grouped in Terrain, Ground, Tree, Avatar, Water, Sky and WLSky. There maybe multiple facepools of each type (one per spatial partition?).

Renderpasses can be Simple, Alpha, Glow, Invisible or Bump passes. There is one instance of each renderpass draw pool.

for each drawpool:

- set up vertex buffer and texture

- render faces to vertex buffer

- render vertex buffer to frame buffer (?)