source: OGRE/trunk/ogrenew/Docs/manual/manual_43.html @ 692

Revision 692, 6.4 KB checked in by mattausch, 18 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1<HTML>
2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3<!-- Created on , 12 2006 by texi2html 1.64 -->
4<!--
5Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
6            Karl Berry  <karl@freefriends.org>
7            Olaf Bachmann <obachman@mathematik.uni-kl.de>
8            and many others.
9Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
10Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
11 
12-->
13<HEAD>
14<TITLE>OGRE Manual v1.2.0 ('Dagon'): Buffer Usage</TITLE>
15
16<META NAME="description" CONTENT="OGRE Manual v1.2.0 ('Dagon'): Buffer Usage">
17<META NAME="keywords" CONTENT="OGRE Manual v1.2.0 ('Dagon'): Buffer Usage">
18<META NAME="resource-type" CONTENT="document">
19<META NAME="distribution" CONTENT="global">
20<META NAME="Generator" CONTENT="texi2html 1.64">
21<LINK TYPE="text/css" rel="stylesheet" href="../style.css"> 
22</HEAD>
23
24<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
25
26<A NAME="SEC232"></A>
27<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
28<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_42.html#SEC231"> &lt; </A>]</TD>
29<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_41.html#SEC230"> Up </A>]</TD>
30<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_44.html#SEC233"> &gt; </A>]</TD>
31<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
32<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_toc.html#SEC_Contents">Contents</A>]</TD>
33<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
34<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_abt.html#SEC_About"> ? </A>]</TD>
35</TR></TABLE>
36<HR SIZE=1>
37<H2> 5.2 Buffer Usage </H2>
38<!--docid::SEC232::-->
39Because the memory in a hardware buffer is likely to be under significant contention during the rendering of a scene, the kind of access you need to the buffer over the time it is used is extremely important; whether you need to update the contents of the buffer regularly, whether you need to be able to read information back from it, these are all important factors to how the graphics card manages the buffer. The method and exact parameters used to create a buffer depends on whether you are creating an index or vertex buffer (See section <A HREF="manual_47.html#SEC237">5.6 Hardware Vertex Buffers</A> and See section <A HREF="manual_52.html#SEC245">5.7 Hardware Index Buffers</A>), however one creation parameter is common to them both - the 'usage'.
40<BR><BR>
41The most optimal type of hardware buffer is one which is not updated often, and is never read from. The usage parameter of createVertexBuffer or createIndexBuffer can be one of the following:
42<DL COMPACT>
43<DT><CODE>HBU_STATIC</CODE>
44<DD>This means you do not need to update the buffer very often, but you might occasionally want to read from it.
45<P>
46
47<DT><CODE>HBU_STATIC_WRITE_ONLY</CODE>
48<DD>This means you do not need to update the buffer very often, and you do not need to read from it. However, you may read from it's shadow buffer if you set one up (See section <A HREF="manual_44.html#SEC233">5.3 Shadow Buffers</A>). This is the optimal buffer usage setting.
49<P>
50
51<DT><CODE>HBU_DYNAMIC</CODE>
52<DD>This means you expect to update the buffer often, and that you may wish to read from it. This is the least optimal buffer setting.
53<P>
54
55<DT><CODE>HBU_DYNAMIC_WRITE_ONLY</CODE>
56<DD>This means you expect to update the buffer often, but that you never want to read from it. However, you may read from it's shadow buffer if you set one up (See section <A HREF="manual_44.html#SEC233">5.3 Shadow Buffers</A>). If you use this option, and replace the entire contents of the buffer every frame, then you should use HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE instead, since that has better performance characteristics on some platforms.
57<P>
58
59<DT><CODE>HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE</CODE>
60<DD>This means that you expect to replace the entire contents of the buffer on an extremely regular basis, most likely every frame. By selecting this option, you free the system up from having to be concerned about losing the existing contents of the buffer at any time, because if it does lose them, you will be replacing them next frame anyway. On some platforms this can make a significant performance difference, so you should try to use this whenever you have a buffer you need to update regularly. Note that if you create a buffer this way, you should use the HBL_DISCARD flag when locking the contents of it for writing.
61<P>
62
63</DL>
64Choosing the usage of your buffers carefully is important to getting optimal performance out of your geometry. If you have a situation where you need to update a vertex buffer often, consider whether you actually need to update <STRONG>all</STRONG> the parts of it, or just some. If it's the latter, consider using more than one buffer, with only the data you need to modify in the HBU_DYNAMIC buffer.
65<BR><BR>
66Always try to use the _WRITE_ONLY forms. This just means that you cannot read <EM>directly</EM> from the hardware buffer, which is good practice because reading from hardware buffers is very slow. If you really need to read data back, use a shadow buffer, described in the next section.
67<P>
68
69<A NAME="Shadow Buffers"></A>
70<HR SIZE=1>
71<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
72<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_42.html#SEC231"> &lt; </A>]</TD>
73<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_41.html#SEC230"> Up </A>]</TD>
74<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_44.html#SEC233"> &gt; </A>]</TD>
75<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
76<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_toc.html#SEC_Contents">Contents</A>]</TD>
77<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
78<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_abt.html#SEC_About"> ? </A>]</TD>
79</TR></TABLE>
80<BR> 
81<FONT SIZE="-1">
82This document was generated
83by <I>Steve Streeting</I> on <I>, 12 2006</I>
84using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
85"><I>texi2html</I></A>
86
87</BODY>
88</HTML>
Note: See TracBrowser for help on using the repository browser.