Difference between revisions of "Rendering System"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with '== Rendering System of SecondLife Viewer 1.22 == Rendering in the viewer starts in llviewerdisplay.cpp in the display() method. * check window state * check if in startup state...')
 
(Added details about drawpools.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Rendering System of SecondLife Viewer 1.22 ==
== 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 in the viewer starts in llviewerdisplay.cpp in the display() method.


* check window state
Rendering follows this flow of events:


* check if in startup state (don't render)
* check window state and client state


* if in teleport mode draw static screen and progress bar
Don't render if window is minimized.


* if logout requested don't draw
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:'''
'''prepare for next frame:'''
Line 57: Line 64:


* rebuild draw pools
* rebuild draw pools
Seems just to remove dead pools from the list of pools.


* update sky
* update sky


redraw skytexture and cubic environment map
Redraws skytexture and cubic environment map.


'''draw geometry'''
'''draw geometry'''
Line 68: Line 77:
* render pipeline
* render pipeline


** unbind vertex buffers (?)
unbind vertex buffers (?)


set safe default state values (matrices and stuff)
set safe default state values (matrices and stuff)


set fog and lights
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:
for each drawpool:
- set up vertex buffer and texture


- render faces to vertex buffer
- render faces to vertex buffer


- render vertex buffer to frame buffer (?)
- render vertex buffer to frame buffer (?)

Latest revision as of 20:29, 15 November 2010

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:

  • check window state and client state

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 camera
  • clear buffer, for drawing of dynamic textures
  • setup rendering
  • reset lights to SL defaults

update window and dynamic textures:

  • update (draw) dynamic(/render-to-texture) 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

  • if any dynamic textures were updated clear color and depth buffer
  • set viewport up (with offsets and window dimensions)

update scene:

  • set camera up

display_camera_update() creates projection matrix and clip distance

  • update HUD
  • update geometry
  • cull geometry
  • clear/flush last frame
  • update images (?)
  • state sorting
  • rebuild draw pools

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

  • update sky

Redraws skytexture and cubic environment map.

draw geometry

  • if render scene to texture (if vertex shaders supported) bind frame buffer to FBO
  • render pipeline

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 (?)