source: OGRE/trunk/ogrenew/Docs/vbo-update/vbo-update_15.html @ 692

Revision 692, 5.3 KB checked in by mattausch, 19 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>Hardware Buffers In OGRE: The IndexData class</TITLE>
15
16<META NAME="description" CONTENT="Hardware Buffers In OGRE: The IndexData class">
17<META NAME="keywords" CONTENT="Hardware Buffers In OGRE: The IndexData class">
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="SEC19"></A>
27<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
28<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_14.html#SEC18"> &lt; </A>]</TD>
29<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_14.html#SEC18"> Up </A>]</TD>
30<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_16.html#SEC21"> &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="vbo-update_toc.html#SEC_Contents">Contents</A>]</TD>
33<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
34<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_abt.html#SEC_About"> ? </A>]</TD>
35</TR></TABLE>
36<HR SIZE=1>
37<H3> 2.7.1 The IndexData class </H3>
38<!--docid::SEC19::-->
39This class summarises the information required to use a set of indexes to render geometry. It's members are as follows:
40<DL COMPACT>
41<DT>indexStart
42<DD>The first index used by this piece of geometry; this can be useful for sharing a single index buffer among several geometry pieces.
43<DT>indexCount
44<DD>The number of indexes used by this particular renderable.
45<DT>indexBuffer
46<DD>The index buffer which is used to source the indexes.
47</DL>
48<P>
49
50<A NAME="SEC20"></A>
51<H3> Creating an Index Buffer </H3>
52<!--docid::SEC20::-->
53Index buffers are created using See section <A HREF="vbo-update_4.html#SEC4">2.1 The Hardware Buffer Manager</A> just like vertex buffers, here's how:
54<TABLE><tr><td>&nbsp;</td><td class=example><pre>HardwareIndexBufferSharedPtr ibuf = HardwareBufferManager::getSingleton().
55        createIndexBuffer(
56                HardwareIndexBuffer::IT_16BIT, // type of index
57                numIndexes, // number of indexes
58                HardwareBuffer::HBU_STATIC_WRITE_ONLY, // usage
59                false); // no shadow buffer     
60</pre></td></tr></table>Once again, notice that the return type is a class rather than a pointer; this is reference counted so that the buffer is automatically destroyed when no more references are made to it. The parameters to the index buffer creation are:
61<DL COMPACT>
62<DT>indexType
63<DD>There are 2 types of index; 16-bit and 32-bit. They both perform the same way, except that the latter can address larger vertex buffers. If your buffer includes more than 65526 vertices, then you will need to use 32-bit indexes. Note that you should only use 32-bit indexes when you need to, since they incur more overhead than 16-bit vertices, and are not supported on some older hardware.
64<DT>numIndexes
65<DD>The number of indexes in the buffer. As with vertex buffers, you should consider whether you can use a shared index buffer which is used by multiple pieces of geometry, since there can be performance advantages to switching index buffers less often.
66<DT>usage
67<DD>This tells the system how you intend to use the buffer. See section <A HREF="vbo-update_5.html#SEC5">2.2 Buffer Usage</A>
68<DT>useShadowBuffer
69<DD>Tells the system whether you want this buffer backed by a system-memory copy. See section <A HREF="vbo-update_6.html#SEC6">2.3 Shadow Buffers</A>
70</DL>
71<P>
72
73<A NAME="Updating Index Buffers"></A>
74<HR SIZE=1>
75<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
76<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_14.html#SEC18"> &lt; </A>]</TD>
77<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_14.html#SEC18"> Up </A>]</TD>
78<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_16.html#SEC21"> &gt; </A>]</TD>
79<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>
80<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_toc.html#SEC_Contents">Contents</A>]</TD>
81<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
82<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="vbo-update_abt.html#SEC_About"> ? </A>]</TD>
83</TR></TABLE>
84<BR> 
85<FONT SIZE="-1">
86This document was generated
87by <I>Steve Streeting</I> on <I>, 12 2006</I>
88using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
89"><I>texi2html</I></A>
90
91</BODY>
92</HTML>
Note: See TracBrowser for help on using the repository browser.